# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43397 | 2018-03-15T19:51:35 Z | Hassoony | Carnival (CEOI14_carnival) | C++14 | 22 ms | 2024 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MX=155; int n,p[MX],vis[MX]; int find(int x){ if(x==p[x])return x; return p[x]=find(p[x]); } map<int,int>hashy; void merge_(int x,int y){ x=find(x); y=find(y); p[y]=x; } int main(){ scanf("%d",&n); cout<<n<<" "; for(int i=1;i<=n;i++){ cout<<i<<" "; } cout<<endl; int x; scanf("%d",&x); if(x==n){ cout<<0<<" "; for(int i=1;i<=n;i++)cout<<i<<" "; cout<<endl; return 0; } for(int i=1;i<=n;i++)p[i]=i; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(vis[i]||vis[j]||find(i)==find(j))continue; cout<<2<<" "<<i<<" "<<j<<endl; int x; scanf("%d",&x); if(x==1)merge_(i,j),vis[j]=1; } } for(int i=1;i<=n;i++){ hashy[p[i]]=1; } int tt=1; for(auto pp:hashy){ hashy[pp.first]=tt++; } cout<<0<<" "; for(int i=1;i<n;i++)cout<<hashy[p[i]]<<" "; cout<<hashy[p[n]]<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2024 KB | Output is correct |
2 | Correct | 10 ms | 2024 KB | Output is correct |
3 | Partially correct | 11 ms | 2024 KB | Partially correct |
4 | Partially correct | 18 ms | 2024 KB | Partially correct |
5 | Correct | 4 ms | 2024 KB | Output is correct |
6 | Correct | 2 ms | 2024 KB | Output is correct |
7 | Correct | 1 ms | 2024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2024 KB | Output is correct |
2 | Correct | 5 ms | 2024 KB | Output is correct |
3 | Partially correct | 4 ms | 2024 KB | Partially correct |
4 | Partially correct | 9 ms | 2024 KB | Partially correct |
5 | Correct | 4 ms | 2024 KB | Output is correct |
6 | Correct | 5 ms | 2024 KB | Output is correct |
7 | Correct | 2 ms | 2024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2024 KB | Output is correct |
2 | Correct | 4 ms | 2024 KB | Output is correct |
3 | Partially correct | 3 ms | 2024 KB | Partially correct |
4 | Partially correct | 13 ms | 2024 KB | Partially correct |
5 | Correct | 8 ms | 2024 KB | Output is correct |
6 | Correct | 6 ms | 2024 KB | Output is correct |
7 | Correct | 6 ms | 2024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2024 KB | Output is correct |
2 | Correct | 1 ms | 2024 KB | Output is correct |
3 | Partially correct | 22 ms | 2024 KB | Partially correct |
4 | Partially correct | 5 ms | 2024 KB | Partially correct |
5 | Correct | 1 ms | 2024 KB | Output is correct |
6 | Correct | 11 ms | 2024 KB | Output is correct |
7 | Correct | 0 ms | 2024 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2024 KB | Output is correct |
2 | Correct | 0 ms | 2024 KB | Output is correct |
3 | Partially correct | 15 ms | 2024 KB | Partially correct |
4 | Partially correct | 7 ms | 2024 KB | Partially correct |
5 | Correct | 6 ms | 2024 KB | Output is correct |
6 | Partially correct | 16 ms | 2024 KB | Partially correct |
7 | Partially correct | 14 ms | 2024 KB | Partially correct |