# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
967537 | 2024-04-22T11:18:35 Z | lanaskarica | Zagonetka (COI18_zagonetka) | C++14 | 1 ms | 452 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair <int, int> #define fi first #define se second const int MAXN = 110; int n, a, p[MAXN]; int pro(int br, int idx) { if (idx == 0) return br + 1; else return br - 1; } void isprobaj(int i, int j, int idx) { int br = 1, d; if (idx == 1) br = n; for (int z = 1; z <= n; z++) { if (z != i && z != j) {cout << br << " "; br = pro(br, idx); continue;} if (z == i) {d = br; br = pro(br, idx); cout << br << " "; br = pro(br, idx);} else {cout << d << " ";} } cout << endl; } void rjesi(int idx) { bool bl = 0; for (int i = n; i > 0; i--) { for (int j = i - 1; j >= 0; j--) { cout << "query "; isprobaj(j, i, idx); cin >> a; if (a == 0) continue; if (idx == 1) { cout << "end" << endl; for (int i = 1; i <= n; i++) cout << i << " "; cout << endl; isprobaj(j, i, idx); } else { cout << "end\n"; isprobaj(j, i, idx); for (int i = 1; i <= n; i++) cout << n - i - 1 << " "; cout << endl; } bl = 1; break; } if (bl == 1) break; } } void solve1() { cout << "query "; for (int i = 1; i <= n; i++) cout << i << " "; cout << endl; cin >> a; rjesi(a); } //void solve1() {} int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> p[i]; if (n <= 70) solve1(); //else solve2(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Runtime error | 0 ms | 452 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 452 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 452 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |