Submission #1040489

# Submission time Handle Problem Language Result Execution time Memory
1040489 2024-08-01T05:59:37 Z 변재우(#10999) How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
10 / 100
1 ms 596 KB
#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;

std::pair<int, int> scout(int R, int H) {
  int a=0, b=0;
  for(int i=0; i<10; i++) {
    vector<int> T;
    for(int j=1; j<=1000; j++) if(!(j&(1<<i))) T.push_back(j);
    send(T);
  }
  for(int i=0; i<10; i++) {
    vector<int> T;
    for(int j=1; j<=1000; j++) if(j&(1<<i)) T.push_back(j);
    send(T);
  }
  vector<int> T=wait();
  vector<int> V;
  int X[10][2]={0};
  for(int i=0; i<10; i++) {
    if(T[i]) X[i][0]=1;
    if(T[10+i]) X[i][1]=1;
    if(X[i][0] && X[i][1]) V.push_back(i);
    if(!X[i][0]) a|=(1<<i), b|=(1<<i);
  }
  if(V.empty()) return {a, b};
  if(V.size()==1) return {a|(1<<V[0]), b};
  for(int i=0; i<V.size()-1; i++) {
    vector<int> t;
    for(int j=1; j<=1000; j++) if((!(j&(1<<V[i]))) && (j&(1<<V[i+1]))) t.push_back(j);
    send(t);
  }
  vector<int> T2=wait();
  b|=(1<<V[0]);
  for(int i=0; i<V.size()-1; i++) {
    if(a&(1<<V[i])) {
      if(!T2[i]) a|=(1<<V[i+1]);
      else b|=(1<<V[i+1]);
    }
    else {
      if(T2[i]) a|=(1<<V[i+1]);
      else b|=(1<<V[i+1]);
    }
  }
  return {a, b};
}

Compilation message

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:28:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i=0; i<V.size()-1; i++) {
      |                ~^~~~~~~~~~~
avoid.cpp:35:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int i=0; i<V.size()-1; i++) {
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# 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 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
2 Correct 0 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
3 Correct 1 ms 344 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 344 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 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
9 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
10 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
11 Correct 1 ms 344 KB Correct: 29 robot(s) used, 2 hour(s) passed
12 Correct 1 ms 344 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 344 KB Correct: 26 robot(s) used, 2 hour(s) passed
15 Correct 1 ms 596 KB Correct: 24 robot(s) used, 2 hour(s) passed
16 Correct 0 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
17 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
18 Correct 1 ms 592 KB Correct: 21 robot(s) used, 2 hour(s) passed
19 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
20 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
21 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
22 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
23 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
24 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
25 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
26 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
27 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
28 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
29 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
30 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
31 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
32 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
33 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
34 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
35 Correct 1 ms 344 KB Correct: 25 robot(s) used, 2 hour(s) passed
36 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
37 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
38 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
39 Correct 0 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
40 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
41 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
42 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
43 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
44 Correct 1 ms 344 KB Correct: 23 robot(s) used, 2 hour(s) passed
45 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
46 Correct 1 ms 344 KB Correct: 20 robot(s) used, 1 hour(s) passed
47 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
48 Correct 1 ms 344 KB Correct: 24 robot(s) used, 2 hour(s) passed
49 Correct 1 ms 348 KB Correct: 24 robot(s) used, 2 hour(s) passed
50 Correct 1 ms 348 KB Correct: 22 robot(s) used, 2 hour(s) passed
51 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
52 Correct 1 ms 344 KB Correct: 22 robot(s) used, 2 hour(s) passed
53 Correct 1 ms 344 KB Correct: 21 robot(s) used, 2 hour(s) passed
54 Correct 1 ms 344 KB Correct: 24 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 -