# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
370637 | 2021-02-24T10:24:10 Z | arnold518 | Zagonetka (COI18_zagonetka) | C++14 | 3 ms | 512 KB |
#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; } if(a>b) swap(a, b); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 3 ms | 364 KB | Output is correct |
4 | Correct | 2 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 2 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 2 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |