!
2023-08-08 10:06:03
发布于:广东
13阅读
0回复
0点赞
#include <iostream>
#include <cstring>
using namespace std;
int vis[510000];
int main()
{
int n;
memset(vis, -1, sizeof(vis)) ;
cin >> n;
int it = 1;
for (int i = 1; i <= n; i++)
{
int t;
cin >> t;
vis[t] = i;
if (it == t)
{
cout << it;
it++;
while ((vis[it] != -1) && (it <= n))
{
cout << "," << it;
it++;
}
cout << endl;
}
}
return 0;
}
这里空空如也
有帮助,赞一个