# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
242920 | 2020-06-29T19:45:26 Z | MatesV13 | Zagonetka (COI18_zagonetka) | C++11 | 17 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; long long n, x, starix, prvi, drugi; vector<int> ansmin, ansmax, cur; int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i=0; i<n; i++) cin >> x; for (int i=1; i<=n; i++) cur.push_back(i); ansmax.resize(n, 0); if (n<7){ do { cout << "query"; for (int i=0; i<n; i++) cout << " " << cur[i]; cout << endl << flush; cin >> x; if (x){ if (ansmin.empty()) ansmin=cur; ansmax=cur; } } while(next_permutation(cur.begin(), cur.end())); cout << "end" << endl; for (int i=0; i<n; i++) cout << ansmin[i] << " "; cout << endl; for (int i=0; i<n; i++) cout << ansmax[i] << " "; cout << endl << flush; } else { cout << "query"; for (int i=0; i<n; i++) cout << " " << cur[i]; cout << endl << flush; cin >> starix; for (int i=0; i<n-1; i++) swap(cur[i], cur[i+1]); for (int i=1; i<=n; i++){ cout << "query"; for (int i=0; i<n; i++) cout << " " << cur[i]; cout << endl << flush; cin >> x; if (x==0 and starix==1) prvi=i; if (x==1 and starix==0) drugi=i; starix=x; for (int i=0; i<n-1; i++) swap(cur[i], cur[i+1]); } cout << "end" << endl; for (int i=1; i<=n; i++){ if (i==drugi) continue; else if (i==prvi) cout << prvi << " " << drugi << " "; else cout << i << " "; } cout << endl; for (int i=n; i>0; i--){ if (i==drugi) continue; else if (i==prvi) cout << prvi << " " << drugi << " "; else cout << i << " "; } cout << endl << flush; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 15 ms | 384 KB | Output is correct |
6 | Correct | 17 ms | 384 KB | Output is correct |
7 | Correct | 10 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |