# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242925 | 2020-06-29T20:30:08 Z | MatesV13 | Zagonetka (COI18_zagonetka) | C++11 | 14 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 and drugi<prvi) continue; else if (i==prvi and drugi<prvi) cout << prvi << " " << drugi << " "; else cout << i << " "; } cout << endl; for (int i=n; i>0; i--){ if (i==drugi and drugi>prvi) continue; else if (i==prvi and prvi<drugi) cout << prvi << " " << drugi << " "; else cout << i << " "; } cout << endl << flush; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 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 | 12 ms | 384 KB | Output is correct |
6 | Correct | 14 ms | 384 KB | Output is correct |
7 | Correct | 13 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Incorrect | 6 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |