제출 #995933

#제출 시각아이디문제언어결과실행 시간메모리
995933daffuwu동굴 (IOI13_cave)C++14
34 / 100
15 ms576 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int s[5069], d[5069], invd[5069], cur, cnt, cur1, ncur; int conv(int x) { if (x == -1) return 5001; return x; } void exploreCave(int n) { int i, j; //mulai dari 000000 //d[i] --> switch i door apa //invd[i] --> door i switch apa for (i=0; i<=n-1; i++) s[i] = 0; for (i=0; i<=n-1; i++) d[i] = -1; ncur = conv(tryCombination(s)); for (cnt=0; cnt<n;) { cur = ncur; // printf("cur = %d\n", cur); j = -1; for (i=0; i<=n-1; i++) { if (d[i] == -1) { s[i] ^= 1; cur1 = conv(tryCombination(s)); // printf("s[%d] = %d cur1 = %d\n", i, s[i], cur1); if (cur1<cur) { d[i] = cur1; cnt++; } else if (cur1>cur) { j = i; d[i] = cur; ncur = cur1; cnt++; // printf("j = %d\n", j); } s[i] ^= 1; } } if (j != -1) s[j] ^= 1; } 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...