Submission #370636

#TimeUsernameProblemLanguageResultExecution timeMemory
370636arnold518Zagonetka (COI18_zagonetka)C++14
0 / 100
3 ms364 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 100; int N, A[MAXN+10], P[MAXN+10]; int query() { printf("query "); for(int i=1; i<=N; i++) printf("%d ", P[i]); printf("\n"); fflush(stdout); int t; scanf("%d", &t); return t; } int main() { scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%d", &A[i]); int a=-1, b=-1; int bef=1; for(int i=1; i<=N; i++) { for(int j=1; j<=N; j++) { P[j]=A[j]+i; if(P[j]>N) P[j]-=N; } int t=query(); if(bef!=t) { if(t==1) { a=1; for(int i=1; i<=N; i++) if(P[a]>P[i]) a=i; } else { b=1; for(int i=1; i<=N; i++) if(P[b]>P[i]) b=i; } } bef=t; } printf("end\n"); fflush(stdout); if(A[a]<A[b]) { for(int i=1; i<=N; i++) printf("%d ", i); printf("\n"); } else { for(int i=1; i<=N; i++) { if(i<a || b<i) printf("%d ", i); else if(i==a) printf("%d ", a+1); else if(i==b) printf("%d ", a); else printf("%d ", i+1); } printf("\n"); } fflush(stdout); if(A[a]>A[b]) { for(int i=1; i<=N; i++) printf("%d ", N-i+1); printf("\n"); } else { for(int i=1; i<=N; i++) { if(i<a || b<i) printf("%d ", N-i+1); else if(i==a) printf("%d ", N-a); else if(i==b) printf("%d ", N-a+1); else printf("%d ", N-i); } printf("\n"); } fflush(stdout); }

Compilation message (stderr)

zagonetka.cpp: In function 'int query()':
zagonetka.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     scanf("%d", &t);
      |     ~~~~~^~~~~~~~~~
zagonetka.cpp: In function 'int main()':
zagonetka.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   25 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
zagonetka.cpp:26:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |     for(int i=1; i<=N; i++) scanf("%d", &A[i]);
      |                             ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...