Submission #1009098

#TimeUsernameProblemLanguageResultExecution timeMemory
1009098PenguinsAreCuteChameleon's Love (JOI20_chameleon)C++17
40 / 100
15 ms472 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; int query(vector<int> v) { for(auto &i: v) i++; return Query(v); } bool qry(vector<int> &v, int x) { int orig = query(v); v.push_back(x); int nw = query(v); v.pop_back(); return (nw==orig); } int loving(int a, int x, int y, int z) { if(query({a,x,y})==1) return z; if(query({a,x,z})==1) return y; return x; } vector<int> adj[1005]; void Solve(int N) { for(int i=0;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); } int love[2*N]; for(int i=0;i<2*N;i++) if(adj[i].size()==3) love[i]=loving(i,adj[i][0],adj[i][1],adj[i][2]); int pear[2*N]; for(int i=0;i<2*N;i++) { if(adj[i].size()==1) pear[i] = adj[i][0]; else for(auto j: adj[i]) if(j!=love[i]&&love[j]!=i) pear[i]=j; } for(int i=0;i<2*N;i++) if(pear[i]>i) Answer(i+1,pear[i]+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...