Submission #413890

#TimeUsernameProblemLanguageResultExecution timeMemory
413890LouayFarahCave (IOI13_cave)C++14
46 / 100
37 ms420 KiB
#include "bits/stdc++.h" #include "cave.h" using namespace std; int tryCombination(int S[]); void answer(int S[], int D[]); vector<bool> visited, opened; void exploreCave(int N) { int S[N]; int D[N]; visited.assign(N, false); opened.assign(N, false); for(int i = 0; i<N; i++) { S[i] = 0; D[i] = i; } int res = 0; int door = 0; while(door<N) { res = tryCombination(S); if(res==-1) { for(int i = 0; i<N; i++) { S[i] = 1 - S[i]; int d = tryCombination(S); S[i] = 1 - S[i]; D[i] = d; } answer(S, D); } for(int i = 0; i<N; i++) { if(!visited[i]) { S[i] = 1 - S[i]; int curr = tryCombination(S); S[i] = 1 - S[i]; if(curr==-1) { S[i] = 1 - S[i]; break; } if(curr<res&&(!opened[curr])) { D[i] = curr; visited[i] = true; opened[curr] = true; } else if(curr>res) { D[i] = res; S[i] = 1 - S[i]; visited[i] = true; opened[res] = true; break; } } } door++; } answer(S, D); }
#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...