Submission #118367

#TimeUsernameProblemLanguageResultExecution timeMemory
118367baqargamCave (IOI13_cave)C++14
0 / 100
813 ms640 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; int n,comb[5005],fx[5005],S[5005],D[5005],rd[5005]; vector<int>v; void set_init(int k){ for(int i=0;i<k;i++){ comb[D[i]]=S[i]; fx[D[i]]=1; } v.clear(); for(int i=0;i<n;i++){ if(!fx[i])v.push_back(i); } } void set2(int m,int i){ for(int j=0;j<m;j++){ comb[v[j]]=S[i]; } for(int j=m;j<v.size();j++){ comb[v[j]]=S[i]; } } void exploreCave(int N) { n=N; for(int i=0;i<n;i++){ set_init(i); int fr=tryCombination(comb); if(fr>i) S[i]=1; else S[i]=0; int l=0,r=v.size(); while(r-l>1){ int m=(l+r)/2; set2(m,i); fr=tryCombination(comb); if(fr>i) r=m; else l=m; } D[i]=v[l]; } for(int i=0;i<n;i++){ rd[D[i]]=i; } answer(S,rd); }

Compilation message (stderr)

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