제출 #1029345

#제출 시각아이디문제언어결과실행 시간메모리
1029345elpro123동굴 (IOI13_cave)C++14
100 / 100
216 ms720 KiB
#include"cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int n){ int puerta[n], swit[n], bloq=0; if(n==1){ puerta[0] = 0; swit[0] = 1; if(tryCombination(swit)==0){ swit[0] = 0; } answer(swit, puerta); } for(int i=0; i<n; i++){ puerta[i] = -1; } for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(puerta[j] == -1){ swit[j] = 0; } } bloq = tryCombination(swit); int l=0,r= n-1, mid, key=1; while(l<r){ if(!(bloq == -1 || bloq > i)){ for(int j=l; j<=r; j++){ if (puerta[j] == -1){ swit[j] = (swit[j]+1)%2;//alternar } } } mid = (l+r)/2; for(int j=l; j<=mid; j++){ if(puerta[j] == -1){ swit[j] = (swit[j]+1)%2; } } bloq = tryCombination(swit); if(bloq == i){ r = mid; key = (swit[l]+1)%2; }else{ l = mid+1; key = swit[l]; } } puerta[l] = i; swit[l] = key; } answer(swit,puerta); }
#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...