Submission #1040607

# Submission time Handle Problem Language Result Execution time Memory
1040607 2024-08-01T07:45:40 Z 우민규(#10996) How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
10 / 100
1 ms 592 KB
#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;

const int n = 1000;

void my_send(function<bool(int)> f) {
  vector<int> to_send;
  for (int i = 0; i < n; ++i) {
    if (f(i)) to_send.push_back(i + 1);
  }
  send(to_send);
}

std::pair<int, int> scout(int R, int H) {
  for (int bit = 0; bit < 10; ++bit) {
    my_send([&](int x) { return (x & (1 << bit)) == 0; });
  }
  for (int bit = 0; bit < 10; ++bit) {
    my_send([&](int x) { return (x & (1 << bit)) != 0; });
  }
  auto p = wait();
  int anb = 0, aob = 0;
  int fst_diff = -1;
  for (int bit = 0; bit < 10; ++bit) {
    int has0 = p[bit], has1 = p[bit + 10];
    if (has1) aob |= 1 << bit;
    if (!has0) anb |= 1 << bit;
    if (has0 && has1) {
      if (fst_diff == -1) fst_diff = bit;
      else {
        my_send([&](int x) { return ((x >> bit) & 1) == ((x >> fst_diff) & 1);});
      }
    }
  }
  
  if (fst_diff == -1) {
    // two are same
    return {anb + 1, anb + 1};
  }

  auto p2 = wait();
  int p2i = 0;
  
  int a = anb, b = anb | (1 << fst_diff);
  for (int bit = 0; bit < 10; ++bit) {
    int has0 = p[bit], has1 = p[bit + 10];
    if (has0 && has1) {
      if (bit == fst_diff) continue;
      bool is_same = p2[p2i++];
      if (!is_same) {
        a |= 1 << bit;
      } else {
        b |= 1 << bit;
      }
    }
  }
  return {a + 1, b + 1};
}

#ifndef EVAL
#include "sample_grader.cpp"
#endif
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 420 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 420 KB Correct: 29 robot(s) used, 2 hour(s) passed
2 Correct 1 ms 416 KB Correct: 29 robot(s) used, 2 hour(s) passed
3 Correct 1 ms 420 KB Correct: 29 robot(s) used, 2 hour(s) passed
4 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
5 Correct 1 ms 420 KB Correct: 29 robot(s) used, 2 hour(s) passed
6 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
7 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
8 Correct 1 ms 416 KB Correct: 29 robot(s) used, 2 hour(s) passed
9 Correct 1 ms 592 KB Correct: 29 robot(s) used, 2 hour(s) passed
10 Correct 1 ms 416 KB Correct: 29 robot(s) used, 2 hour(s) passed
11 Correct 1 ms 424 KB Correct: 29 robot(s) used, 2 hour(s) passed
12 Correct 1 ms 416 KB Correct: 26 robot(s) used, 2 hour(s) passed
13 Correct 1 ms 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
14 Correct 1 ms 420 KB Correct: 26 robot(s) used, 2 hour(s) passed
15 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
16 Correct 0 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
17 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
18 Correct 1 ms 420 KB Correct: 23 robot(s) used, 2 hour(s) passed
19 Correct 1 ms 424 KB Correct: 22 robot(s) used, 2 hour(s) passed
20 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
21 Correct 1 ms 440 KB Correct: 23 robot(s) used, 2 hour(s) passed
22 Correct 0 ms 416 KB Correct: 25 robot(s) used, 2 hour(s) passed
23 Correct 1 ms 420 KB Correct: 24 robot(s) used, 2 hour(s) passed
24 Correct 1 ms 416 KB Correct: 22 robot(s) used, 2 hour(s) passed
25 Correct 1 ms 420 KB Correct: 23 robot(s) used, 2 hour(s) passed
26 Correct 1 ms 444 KB Correct: 22 robot(s) used, 2 hour(s) passed
27 Correct 1 ms 420 KB Correct: 22 robot(s) used, 2 hour(s) passed
28 Correct 1 ms 592 KB Correct: 21 robot(s) used, 2 hour(s) passed
29 Correct 0 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
30 Correct 1 ms 424 KB Correct: 24 robot(s) used, 2 hour(s) passed
31 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
32 Correct 1 ms 424 KB Correct: 24 robot(s) used, 2 hour(s) passed
33 Correct 1 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
34 Correct 1 ms 344 KB Correct: 20 robot(s) used, 2 hour(s) passed
35 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
36 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
37 Correct 1 ms 424 KB Correct: 23 robot(s) used, 2 hour(s) passed
38 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
39 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
40 Correct 1 ms 444 KB Correct: 23 robot(s) used, 2 hour(s) passed
41 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
42 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
43 Correct 1 ms 420 KB Correct: 22 robot(s) used, 2 hour(s) passed
44 Correct 0 ms 420 KB Correct: 22 robot(s) used, 2 hour(s) passed
45 Correct 1 ms 416 KB Correct: 24 robot(s) used, 2 hour(s) passed
46 Correct 1 ms 420 KB Correct: 21 robot(s) used, 2 hour(s) passed
47 Correct 1 ms 436 KB Correct: 24 robot(s) used, 2 hour(s) passed
48 Correct 1 ms 436 KB Correct: 25 robot(s) used, 2 hour(s) passed
49 Correct 0 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
50 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
51 Correct 1 ms 420 KB Correct: 21 robot(s) used, 2 hour(s) passed
52 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
53 Correct 0 ms 420 KB Correct: 21 robot(s) used, 2 hour(s) passed
54 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 420 KB Not correct
2 Halted 0 ms 0 KB -