제출 #95325

#제출 시각아이디문제언어결과실행 시간메모리
95325someone_aa동굴 (IOI13_cave)C++17
34 / 100
84 ms632 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int combination[N]; memset(combination, false, sizeof(combination)); bool found[N]; memset(found, false, sizeof(found)); int connection[N]; memset(connection, 0, sizeof(connection)); bool foundswitch[N]; memset(foundswitch, 0, sizeof(foundswitch)); int n = N; for(int i=0;i<N;i++) { int st = tryCombination(combination); if(st == -1) st = n; for(int j=0;j<N;j++) { if(found[j]) continue; combination[j] = true; int x = tryCombination(combination); if(x == -1) x = n; combination[j] = false; //cout<<j<<" - "<<x<<" and "<<st<<"\n"; if(x == st) continue; else if(x < st && !foundswitch[x]) { // we have closed the x'th door found[j] = true; combination[j] = false; connection[j] = x; foundswitch[x] = true; } else if(x > st && !foundswitch[st]) { found[j] = true; combination[j] = true; connection[j] = st; foundswitch[st] = true; // we have opened the st'th door } } } answer(combination, connection); }
#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...