제출 #852538

#제출 시각아이디문제언어결과실행 시간메모리
852538muratcepeda동굴 (IOI13_cave)C++17
100 / 100
205 ms868 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int arr[N], bien[N], puerta[N], pos[N]; int ini = 0; int fin = N; int mitad = 0; int ayu = 0; int nuevo = 0; for(int i = 0; i < N; ++i) arr[i] = bien[i] = puerta[i] = pos[i] = 0; for(int i = 0; i < N; ++i){ for(int borra = 0; borra < N; ++borra){ if(bien[borra] == 0) arr[borra] = 0; } ayu = tryCombination(arr); ini = 0; fin = N - 1; while(ini < fin){ mitad = (ini + fin) / 2; for(int j = ini; j <= mitad; ++j)if(bien[j] == 0) arr[j] ^= 1; nuevo = tryCombination(arr); if (!i){ //cout << ini << " " << fin << " " << mitad << " " << ayu << " " << nuevo << "\n"; } if(nuevo == ayu || (ayu != i && nuevo != i)) ini = mitad + 1; else fin = mitad; ayu = nuevo; } puerta[fin] = i; if(ayu == i) arr[fin] ^= 1; pos[fin] = arr[fin]; bien[fin] = 1; } answer(pos, 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...