제출 #166540

#제출 시각아이디문제언어결과실행 시간메모리
166540wilwxk사육제 (CEOI14_carnival)C++14
0 / 100
3 ms376 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN=155; int rep[MAXN], repp[MAXN]; int mp[MAXN]; int n, cnt; int find(int x) { return rep[x]= rep[x]==x ? x : find(rep[x]); } void une(int a, int b) { a=find(a); b=find(b); if(a==b) return; if(repp[a]>repp[b]) swap(a, b); rep[a]=b; } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) rep[i]=repp[i]=i; for(int i=1; i<=n; i++) { for(int j=1; j<i; j++) { printf("2 %d %d\n", i, j); int x; scanf("%d", &x); if(x==1) une(i, j); fflush(stdout); } } printf("0 "); for(int i=1; i<=n; i++) { if(!mp[find(i)]) mp[find(i)]=++cnt; printf("%d ", mp[find(i)]); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

carnival.cpp: In function 'int main()':
carnival.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
carnival.cpp:25:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             int x; scanf("%d", &x);
                    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...