Submission #245988

#TimeUsernameProblemLanguageResultExecution timeMemory
245988kimbj0709Cave (IOI13_cave)C++14
100 / 100
346 ms760 KiB
#include<bits/stdc++.h> using namespace std; #include "cave.h" void exploreCave(int N) { vector<int> ans(N); int pos[N]; for(int i=0;i<N;i++){ pos[i] = 0; } deque<int> currelem; for(int i=0;i<N;i++){ currelem.push_back(i); } for(int i=0;i<N;i++){ int rn = tryCombination(pos); if(rn==-1||rn>i){ } else{ for(auto k:currelem){ pos[k] ^= 1; } } deque<int> curr = currelem; while(curr.size()>1){ int mid = (curr.size()+1)/2; for(int j=0;j<mid;j++){ pos[curr[j]] ^= 1; } int idk = tryCombination(pos); for(int j=0;j<mid;j++){ pos[curr[j]] ^= 1; } if(idk==-1||idk>i){ for(int j=0;j<mid;j++){ curr.pop_front(); } } else{ int sss = curr.size(); for(int j=sss-1;j>=mid;j--){ curr.pop_back(); } } } int p = 0; for(int j=0;j<currelem.size();j++){ if(currelem[j]==curr[0]){ p = j; } } ans[curr[0]] = i; currelem.erase(currelem.begin()+p); } int temp1[N]; for(int i=0;i<N;i++){ temp1[i] = ans[i]; } answer(pos,temp1); return; }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:46:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<currelem.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...