Submission #1040493

#TimeUsernameProblemLanguageResultExecution timeMemory
1040493byunjaewooHow to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid)C++17
10 / 100
1 ms344 KiB
#include "avoid.h" #include <bits/stdc++.h> using namespace 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}; 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 (stderr)

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:27:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int i=0; i<V.size()-1; i++) {
      |                ~^~~~~~~~~~~
avoid.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(int i=0; i<V.size()-1; i++) {
      |                ~^~~~~~~~~~~
#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...