Submission #751902

#TimeUsernameProblemLanguageResultExecution timeMemory
751902puppyChameleon's Love (JOI20_chameleon)C++17
40 / 100
20 ms348 KiB
#include "chameleon.h" #include <vector> #include <cassert> #include <iostream> using namespace std; namespace { int variable_example = 1; int love[1005]; int by[1005]; vector<int> one[1005]; bool used[1005]; } // namespace void Solve(int N) { if (N == 2) { for (int i = 1; i <= 2 * N; i++) { for (int j = i + 1; j <= 2 * N; j++) { vector<int> v; v.push_back(i); v.push_back(j); if (Query(v) == 1) { Answer(i, j); } } } return; } for (int i = 1; i <= 2 * N; i++) { for (int j = 1; j <= 2 * N; j++) { if (i == j) continue; vector<int> v; v.push_back(i); v.push_back(j); if (Query(v) == 1) one[i].push_back(j); } if (one[i].size() == 1) { int tst = one[i][0]; if (used[i] || used[tst]) continue; Answer(i, tst); used[i] = true; used[tst] = true; } else { for (int p = 0; p < 3; p++) { for (int q = p + 1; q < 3; q++) { vector<int> v; v.push_back(i); v.push_back(one[i][p]); v.push_back(one[i][q]); if (Query(v) == 1) { love[i] = one[i][3-p-q]; } } } } } for (int i = 1; i <= 2 * N; i++) by[love[i]] = i; for (int i = 1; i <= 2 * N; i++) { if (used[i]) continue; int to = -1; to = one[i][0] + one[i][1] + one[i][2] - love[i] - by[i]; Answer(i, to); used[i] = used[to] = true; } }

Compilation message (stderr)

chameleon.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...