# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
444755 | 2021-07-15T05:49:07 Z | ics0503 | 카멜레온의 사랑 (JOI20_chameleon) | C++17 | 41 ms | 472 KB |
#include "chameleon.h" #include <vector> #include<algorithm> using namespace std; int cck[1212]; int validation(int n, int i, int j) { vector<int>qr; for (int p = 1; p <= 2 * n; p++) { if (i == p || j == p)continue; qr.push_back(p); } int Q = Query(qr); if (Q != n) { cck[i] = cck[j] = 1; Answer(i, j); return 1; } return 0; } int S4(int who, vector<int>Y, int n) { int sz = Y.size(), i, j; if (sz == 1) { return validation(n, who, Y[0]); } vector<int>L, R; for (i = 0; i < sz / 2; i++)L.push_back(Y[i]); for (i = sz / 2; i < sz; i++)R.push_back(Y[i]); L.push_back(who); int a = Query(L); L.pop_back(); if (a != L.size() + 1) if (S4(who, L, n))return 1; R.push_back(who); int b = Query(R); R.pop_back(); if (b != R.size() + 1) if (S4(who, R, n))return 1; return 0; } vector<int>AX, AY; int pk[1212]; void Solve(int n) { int i, j; while (1) { vector<int>X; vector<int>aa; for (i = 1; i <= 2 * n; i++)aa.push_back(i); random_shuffle(aa.begin(), aa.end()); for (i = 1; i <= 2 * n; i++)pk[i] = 0; int cnt = 0; for (auto i: aa) { if (cck[i])continue; cnt++; X.push_back(i); if (Query(X) != X.size()) { X.pop_back(); } else { pk[i] = 1; } } if (cnt == 0)break; AX.clear(); AY.clear(); for (i = 1; i <= 2 * n; i++) { if (cck[i])continue; if (pk[i])AX.push_back(i); else AY.push_back(i); } for (i = 0; i < AX.size(); i++) { int who = AX[i]; vector<int>Y; for (j = 0; j < AY.size(); j++) { int v = AY[j]; if (cck[v])continue; Y.push_back(v); } S4(who, Y, n); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 22 ms | 356 KB | Output is correct |
4 | Correct | 23 ms | 348 KB | Output is correct |
5 | Correct | 23 ms | 332 KB | Output is correct |
6 | Correct | 23 ms | 328 KB | Output is correct |
7 | Correct | 24 ms | 328 KB | Output is correct |
8 | Correct | 23 ms | 356 KB | Output is correct |
9 | Correct | 25 ms | 356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 0 ms | 200 KB | Output is correct |
6 | Correct | 0 ms | 200 KB | Output is correct |
7 | Correct | 0 ms | 200 KB | Output is correct |
8 | Correct | 0 ms | 200 KB | Output is correct |
9 | Correct | 0 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 0 ms | 200 KB | Output is correct |
4 | Correct | 0 ms | 200 KB | Output is correct |
5 | Correct | 0 ms | 200 KB | Output is correct |
6 | Correct | 0 ms | 200 KB | Output is correct |
7 | Correct | 0 ms | 200 KB | Output is correct |
8 | Correct | 0 ms | 200 KB | Output is correct |
9 | Correct | 0 ms | 200 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 200 KB | Output is correct |
12 | Correct | 1 ms | 200 KB | Output is correct |
13 | Correct | 1 ms | 200 KB | Output is correct |
14 | Correct | 1 ms | 200 KB | Output is correct |
15 | Correct | 1 ms | 200 KB | Output is correct |
16 | Correct | 1 ms | 200 KB | Output is correct |
17 | Correct | 1 ms | 200 KB | Output is correct |
18 | Correct | 1 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 32 ms | 328 KB | Output is correct |
4 | Correct | 33 ms | 472 KB | Output is correct |
5 | Correct | 33 ms | 368 KB | Output is correct |
6 | Correct | 40 ms | 328 KB | Output is correct |
7 | Correct | 34 ms | 456 KB | Output is correct |
8 | Correct | 38 ms | 336 KB | Output is correct |
9 | Correct | 33 ms | 328 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 200 KB | Output is correct |
2 | Correct | 0 ms | 200 KB | Output is correct |
3 | Correct | 22 ms | 356 KB | Output is correct |
4 | Correct | 23 ms | 348 KB | Output is correct |
5 | Correct | 23 ms | 332 KB | Output is correct |
6 | Correct | 23 ms | 328 KB | Output is correct |
7 | Correct | 24 ms | 328 KB | Output is correct |
8 | Correct | 23 ms | 356 KB | Output is correct |
9 | Correct | 25 ms | 356 KB | Output is correct |
10 | Correct | 0 ms | 200 KB | Output is correct |
11 | Correct | 0 ms | 200 KB | Output is correct |
12 | Correct | 0 ms | 200 KB | Output is correct |
13 | Correct | 0 ms | 200 KB | Output is correct |
14 | Correct | 0 ms | 200 KB | Output is correct |
15 | Correct | 0 ms | 200 KB | Output is correct |
16 | Correct | 0 ms | 200 KB | Output is correct |
17 | Correct | 0 ms | 200 KB | Output is correct |
18 | Correct | 0 ms | 200 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 1 ms | 200 KB | Output is correct |
21 | Correct | 1 ms | 200 KB | Output is correct |
22 | Correct | 1 ms | 200 KB | Output is correct |
23 | Correct | 1 ms | 200 KB | Output is correct |
24 | Correct | 1 ms | 200 KB | Output is correct |
25 | Correct | 1 ms | 200 KB | Output is correct |
26 | Correct | 1 ms | 200 KB | Output is correct |
27 | Correct | 1 ms | 200 KB | Output is correct |
28 | Correct | 0 ms | 200 KB | Output is correct |
29 | Correct | 0 ms | 200 KB | Output is correct |
30 | Correct | 32 ms | 328 KB | Output is correct |
31 | Correct | 33 ms | 472 KB | Output is correct |
32 | Correct | 33 ms | 368 KB | Output is correct |
33 | Correct | 40 ms | 328 KB | Output is correct |
34 | Correct | 34 ms | 456 KB | Output is correct |
35 | Correct | 38 ms | 336 KB | Output is correct |
36 | Correct | 33 ms | 328 KB | Output is correct |
37 | Incorrect | 41 ms | 340 KB | Wrong Answer [3] |
38 | Halted | 0 ms | 0 KB | - |