Submission #1032476

#TimeUsernameProblemLanguageResultExecution timeMemory
1032476aymanrsChameleon's Love (JOI20_chameleon)C++14
0 / 100
1 ms348 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; char samecol(int i, vector<int> g[], int j){ if(i==j) return 1; for(int k : g[i]){ int r = samecol(k, g, j); if(r) return -r; } return 0; } void Solve(int N) { bool v[2*N+1] = {false}; int d[2*N+1] = {0}; vector<int> g[2*N+1]; auto adde = [&g](int a, int b) -> void { g[a].push_back(b); g[b].push_back(a); }; for(int i = 1;i <= N;i++){ int l = N+1, r = 2*N, m; while(l<r){ m = l+r>>1; vector<int> s;for(int j = l;j <= m;j++) s.push_back(j); int te = Query(s); s.push_back(i); if(Query(s) == te){ r = m; } else l=m+1; } Answer(i,l); } }

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:24:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |       m = l+r>>1;
      |           ~^~
chameleon.cpp:14:8: warning: unused variable 'v' [-Wunused-variable]
   14 |   bool v[2*N+1] = {false};
      |        ^
chameleon.cpp:15:7: warning: unused variable 'd' [-Wunused-variable]
   15 |   int d[2*N+1] = {0};
      |       ^
chameleon.cpp:17:8: warning: variable 'adde' set but not used [-Wunused-but-set-variable]
   17 |   auto adde = [&g](int a, int b) -> void {
      |        ^~~~
#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...