Submission #1000273

#TimeUsernameProblemLanguageResultExecution timeMemory
1000273UnforgettableplChameleon's Love (JOI20_chameleon)C++17
40 / 100
21 ms476 KiB
#include <bits/stdc++.h> using namespace std; int Query(const std::vector<int> &p); void Answer(int a, int b); void Solve(int N) { int n = N; vector<vector<int>> adj(2*n+1); set<pair<int,int>> edges; for(int i=1;i<=2*n;i++){ for(int j=i+1;j<=2*n;j++){ if(Query({i,j})==1){ edges.insert({i,j}); adj[i].emplace_back(j); adj[j].emplace_back(i); } } } for(int i=1;i<=2*n;i++){ if(adj[i].size()==1)continue; assert(adj[i].size()==3); if(Query({i,adj[i][0],adj[i][1]})==1)edges.erase({min(i,adj[i][2]),max(i,adj[i][2])}); else if(Query({i,adj[i][0],adj[i][2]})==1)edges.erase({min(i,adj[i][1]),max(i,adj[i][1])}); else edges.erase({min(i,adj[i][0]),max(i,adj[i][0])}); } for(auto[a,b]:edges)Answer(a,b); }
#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...