Submission #269550

# Submission time Handle Problem Language Result Execution time Memory
269550 2020-08-17T07:45:20 Z 임성재(#5102) Chameleon's Love (JOI20_chameleon) C++17
0 / 100
2 ms 512 KB
#include "chameleon.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair

bool chk[555];

int f(int l, int r, int k) {
  if(l == r) return l;

  int m = l + r >> 1;
  vector<int> x = {k}, y;
  for(int i=l; i<=m; i++) {
    if(i != k) x.eb(i), y.eb(i);
  }

  if(Query(x) == Query(y)) {
    return f(l, m, k);
  }
  else return f(m+1, r, k);
}

void Solve(int N) {
  int n = N;
  for(int i=1; i <= 2 * n; i++) {
    if(chk[i]) continue;
    int j = f(1, 2*n, i);
    chk[i] = chk[j] = true;

    Answer(i, j);
  }
}

Compilation message

chameleon.cpp: In function 'int f(int, int, int)':
chameleon.cpp:18:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   18 |   int m = l + r >> 1;
      |           ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Wrong Answer [5]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Wrong Answer [5]
4 Halted 0 ms 0 KB -