Submission #1032476

# Submission time Handle Problem Language Result Execution time Memory
1032476 2024-07-23T20:24:18 Z aymanrs Chameleon's Love (JOI20_chameleon) C++14
0 / 100
1 ms 348 KB
#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

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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 344 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 344 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -