Submission #212782

#TimeUsernameProblemLanguageResultExecution timeMemory
212782usernameChameleon's Love (JOI20_chameleon)C++14
40 / 100
26 ms384 KiB
#include "chameleon.h" // #include<bits/stdc++.h> #define REP(i,j,k) for(int i=(j);i<(k);++i) #define pb push_back using namespace std; void Solve(int n){ const int maxm=1009; vector<int>g[maxm]; int m,mch[maxm]; m=n<<1; REP(i,0,m){ REP(j,0,i){ int x=Query({i+1,j+1}); if(x==1)g[i].pb(j),g[j].pb(i); } } memset(mch,-1,sizeof mch); REP(u,0,m){ REP(i,0,g[u].size()){ int v=g[u][i]; if(mch[u]>=0||mch[v]>=0)continue; if(g[u].size()==1||g[v].size()==1){ mch[u]=v,mch[v]=u; continue; } REP(j,0,g[u].size()){ int nv=g[u][j]; if(nv==v)continue; REP(k,0,g[v].size()){ int nu=g[v][k]; if(nu==u)continue; if(Query({u+1,v+1,nv+1})==1&&Query({u+1,nu+1,v+1})==1){ mch[u]=v,mch[v]=u; goto fin; } } } fin:; } } REP(i,0,m)if(mch[i]<i)Answer(mch[i]+1,i+1); } //

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:4:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(int i=(j);i<(k);++i)
                                   ^
chameleon.cpp:21:3: note: in expansion of macro 'REP'
   REP(i,0,g[u].size()){
   ^~~
chameleon.cpp:4:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(int i=(j);i<(k);++i)
                                   ^
chameleon.cpp:28:4: note: in expansion of macro 'REP'
    REP(j,0,g[u].size()){
    ^~~
chameleon.cpp:4:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,j,k) for(int i=(j);i<(k);++i)
                                   ^
chameleon.cpp:31:5: note: in expansion of macro 'REP'
     REP(k,0,g[v].size()){
     ^~~
#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...