Submission #932918

#TimeUsernameProblemLanguageResultExecution timeMemory
932918nguyentunglamChameleon's Love (JOI20_chameleon)C++17
40 / 100
15 ms2648 KiB
#include "chameleon.h" #include <vector> #include<bits/stdc++.h> using namespace std; namespace { const int NN = 1e3 + 10; vector<int> adj[NN]; int love[NN][NN]; void solve(int n) { for(int i = 1; i <= 2 * n; i++) for(int j = i + 1; j <= 2 * n; j++) { if (Query({i, j}) == 1) { adj[i].push_back(j); adj[j].push_back(i); } } for(int i = 1; i <= 2 * n; i++) { assert(adj[i].size() == 1 || adj[i].size() == 3); if (adj[i].size() == 1) continue; for(int &j : adj[i]) { vector<int> tmp; tmp.push_back(i); for(int &k : adj[i]) if (k != j) tmp.push_back(k); if (Query(tmp) == 1) { love[i][j] = 1; } } } for(int i = 1; i <= 2 * n; i++) { for(int &j : adj[i]) if (i < j && love[i][j] + love[j][i] == 0) { Answer(i, j); } } } } // namespace void Solve(int n) { ::solve(n); }
#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...