Submission #166671

#TimeUsernameProblemLanguageResultExecution timeMemory
166671wilwxkCarnival (CEOI14_carnival)C++11
0 / 100
5 ms376 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const int MAXN=155; int rep[MAXN], mp[MAXN]; vector<int> v; int n, cnt; void query(int cur, int ini, int fim) { printf("query %d %d %d\n", cur, ini, fim); if(fim<ini) return; if(ini==fim) { printf("2 %d %d\n", cur, v[ini]); fflush(stdout); int x; scanf("%d", &x); if(x==1) rep[cur]=v[ini]; return; } int mid=(ini+fim)/2; printf("%d %d ", mid-ini+2, cur); for(int i=ini; i<=mid; i++) printf("%d ", v[i]); printf("\n"); fflush(stdout); int x; scanf("%d", &x); if(x>mid-ini+1) ini=mid+1; else fim=mid; query(cur, ini, fim); } int main() { scanf("%d", &n); for(int i=1; i<=n; i++) rep[i]=i; v.push_back(1); for(int i=2; i<=n; i++) { query(i, 0, v.size()-1); if(rep[i]==i) v.push_back(i); printf("%d >> %d\n", i, rep[i]); } printf("0 "); for(int i=1; i<=n; i++) { if(!mp[rep[i]]) mp[rep[i]]=++cnt; printf("%d ", mp[rep[i]]); } }

Compilation message (stderr)

carnival.cpp: In function 'void query(int, int, int)':
carnival.cpp:17:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int x; scanf("%d", &x);
                ~~~~~^~~~~~~~~~
carnival.cpp:26:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int x; scanf("%d", &x);
            ~~~~~^~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
#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...