Submission #429818

#TimeUsernameProblemLanguageResultExecution timeMemory
429818DaktoCave (IOI13_cave)C++17
0 / 100
800 ms464 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int S[5000], D[5000]; void exploreCave(int n) { vector<int> switches(n,-1),indices(n,-1); for(int i=0; i<n; i++){ for(int j=0; j<n; j++) S[j]=(switches[j]==1); bool correct=(i==tryCombination(S)); vector<int> fr; for(int j=0; j<n; j++){ if(switches[j]==-1) fr.push_back(j); } while(fr.size()>1){ vector<int> v1,v2; for(int j=0; j<fr.size(); j++){ if(j%2) v1.push_back(fr[j]); else v2.push_back(fr[j]); } for(int j=0; j<n; j++) S[j]=(switches[j]==1); for(auto j:v1) S[j]=correct; if(tryCombination(S)!=i) fr=v1; else fr=v2; } switches[fr[0]]=correct; indices[fr[0]]=i; } for(int j=0; j<n; j++) S[j]=(switches[j]==1); for(int j=0; j<n; j++) D[j]=indices[j]; answer(S,D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for(int j=0; j<fr.size(); j++){
      |                          ~^~~~~~~~~~
#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...