Submission #916732

#TimeUsernameProblemLanguageResultExecution timeMemory
916732WarinchaiCave (IOI13_cave)C++14
0 / 100
110 ms564 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; int sans[5005]; int dans[5005]; int isans[5005]; int temp[5005]; vector<int>v; /*void answer(int s[],int d[]){ for(int i=0;i<s.size();i++)cout<<s[i]<<" "; cout<<"\n"; for(int i=0;i<d.size();i++)cout<<d[i]<<" "; }*/ void exploreCave(int N) { int ans[N]={}; int door[N]={}; for(int i=0;i<N;i++){ for(int j=0;j<N;j++)temp[j]=0; for(int j=0;j<N;j++){ if(isans[j])temp[j]=ans[j]; } int on; if(tryCombination(temp)==i)on=1; else on=0; v.clear(); for(int i=0;i<N;i++)if(isans[i])v.push_back(i); int st=0,en=v.size();int pos=0; while(st<=en){ int m=(st+en)/2; for(int j=0;j<v.size();j++){ temp[v[j]]=on^1; } for(int j=0;j<m;j++){ temp[v[j]]=on; } if(tryCombination(temp)<=i){ pos=m-1; en=m-1; }else{ st=m+1; } } isans[pos]=1; ans[pos]=on; door[i]=pos; } answer(ans,door); /* ... */ } /*int main(){ int n; cin>>n; for(int i=0;i<n;i++)cin>>sans[i]; for(int i=0;i<n;i++)cin>>dans[i]; exploreCave(n); }*/

Compilation message (stderr)

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