A.Snacktower

模拟

我和官方题解的命名神相似...$has$

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=1e5+5;
inline int read(){
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();}
    return x*f;
}
int n,has[N];
int main(){
    //freopen("in","r",stdin);
    n=read();
    int now=n;
    for(int i=1;i<=n;i++){
        has[read()]=1;
        while(has[now]) printf("%d ",now),now--;
        puts("");
    }
}
View Code

相关文章:

  • 2021-07-16
  • 2021-10-25
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-06-08
  • 2021-10-10
  • 2021-05-20
  • 2021-09-09
  • 2021-11-03
  • 2021-07-18
相关资源
相似解决方案