제출 #1310665

#제출 시각아이디문제언어결과실행 시간메모리
1310665lizi14동굴 (IOI13_cave)C++20
0 / 100
42 ms512 KiB
#include <iostream> #include <fstream> #include <bits/stdc++.h> #include <cstdlib> #include <cstdio> #include "cave.h" using namespace std; void exploreCave(int N) { int x[N]; fill(x,x+N,1); int s[N]; fill(s,s+N,0); int c[N]; fill(c,c+N,0); //vector<int>x(N,1),s(N,0),c(N,0); int an=0; int f=0; int h=0; int ans=0; while(h<N){ int l=0,r=N; while(r-l>1){ int mid=(l+r)/2; for(int i=l; i<mid; i++){ if(s[i]==0){ x[i]=1-x[i]; } } int k=tryCombination(x); for(int i=l; i<mid; i++){ if(s[i]==0){ x[i]=1-x[i]; } } if(k==-1 || k>h){ l=mid; //ans=l; } else{ r=mid; } //else r=mid-1; } ans=l; x[ans]=0; if(tryCombination(x)==h)x[ans]=1; s[ans]=1; c[ans]=h; // an=a; // //x[ans]=1-x[ans]; // s[ans]=1; // c[ans]=h; // for(int i=0; i<N; i++){ // if(s[i]==0){ // x[i]=0; // } // } h++; } //h++; // else{ // for(int i=0; i<N; i++){ // if(s[i]==0){ // x[i]=1-x[i]; // //f=x[i]; // } // } // } // for(int i=0; i<N; i++){ // cout<<x[i]<<" "; // } // cout<<endl; //x[a]=1-x[a]; return answer(x, c); }
#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...