标签:return clu turn ace ssi pre class std 忽略
题目链接:https://codeforces.com/problemset/problem/1081/B
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
int a[maxn],ans[maxn];
vector<int> v[maxn];
int main()
{
int n,x;
cin>>n;
for(int i=1;i<=n;i++){
cin>>x , x = n - x;
v[x].push_back(i);
}
int cnt = 1;
for(int i=1;i<=n;i++){
int siz = v[i].size();
if(siz%i != 0){
cout<<"Impossible"<<endl;
return 0;
}
for(int j=0;j<siz;j++){
ans[v[i][j]] = cnt;
if((j+1)%i == 0)
cnt++;
}
}
cout<<"Possible"<<endl;
for(int i=1;i<=n;i++)
cout<<ans[i]<<" ";
return 0;
}
标签:return clu turn ace ssi pre class std 忽略
原文地址:https://www.cnblogs.com/QFNU-ACM/p/12544203.html