제출 #782251

#제출 시각아이디문제언어결과실행 시간메모리
782251Minindu206동굴 (IOI13_cave)C++14
12 / 100
44 ms412 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int n) { int sw[n], st[n], temp[n]; for(int i=0;i<n;i++) st[i] = 0, sw[i] = -1; int cc = tryCombination(st); if(cc == -1) { for(int i=0;i<n;i++) { temp[i] = 1; cc = tryCombination(temp); sw[i] = cc; temp[i] = 0; } answer(st, sw); return; } for(int i=0;i<n;i++) { int cmb = tryCombination(st), swt = 1; if(cmb == -1) cmb = n; if(cmb > i || cmb == -1) swt = 0; // st[i] = swt; memset(temp, 1 - swt, sizeof(temp)); for(int j=0;j<n;j++) { if(sw[j] != -1) temp[j] = st[j]; } for(int j=0;j<n;j++) { if(sw[j] != -1) continue; temp[j] = swt; cmb = tryCombination(temp); if(cmb > i || cmb == -1) { sw[j] = i; st[j] = swt; break; } temp[j] = 1 - temp[j]; } // for(int j=0;j<n;j++) // cout << st[i] << " "; // cout << '\n'; // for(int j=0;j<n;j++) // cout << sw[i] << " "; // cout << '\n'; } answer(st, sw); }
#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...