热门

最新

红包

立Flag

投票

同城

我的

发布
hzpfly66
贺喜喜
4 年前
truehzpfly66

Communication is the most important in work career. Why? Because the people with better communication skill will be more valuable to the company. And will be promoted faster than others.

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
#704 B#include <iostream>#include <cstring>#include <algorithm>#include<stdio.h>using namespace std;int n, p[100010], pos[100010];bool used[100010], numused[100010];int main(){ int t; scanf("%d",&t); while(t--) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d", p + i); pos[p[i]] = i; } memset(used, 0, sizeof(used)); memset(numused, 0, sizeof(numused)); int cur = n; used[n + 1] = true; while (cur >= 1) { if (numused[cur]) { cur--; continue; } for (int i = pos[cur]; !used[i]; i++) { if (p[i] == cur) { for (int j = i; !used[j]; j++) { used[j] = true; numused[p[j]] = true; printf("%d ", p[j]); } } } cur--; } } return 0;}
立即登录