# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1083179 |
2024-09-02T17:16:33 Z |
erdemfurkan |
Cave (IOI13_cave) |
C++14 |
|
83 ms |
744 KB |
#include "cave.h"
#include <algorithm>
#include <iostream>
bool found[5005];
int yer[5005];
using std::endl;
using std::cout;
int ara(int A[], int N, int L, int R, int T, int O) {
if(L >= R) return L;
int B[N];
for(int i = 0; i < N; i++) {
B[i] = A[i];
}
int mid = (R+L)/2;
for(int i = L; i <= mid; i++) {
if(!found[i]) {
B[i] = !B[i];
}
}
int x = tryCombination(B);
if(x == T) {
return ara(A, N, mid+1, R, T, O);
} else {
return ara(A, N, L, mid, T, O);
}
}
void exploreCave(int N) {
int A[N];
for(int i = 0; i < N; i++) A[i] = 0;
int D[N];
int cur = 0;
int tmp = 0;
int i = 0;
for(int i = 0; i < N; i++) {
int x = tryCombination(A);
if(x == i) {
int y = ara(A, N, 0, N-1, i, 0);
D[y] = i;
found[y] = true;
A[y] = !A[y];
} else {
int y = ara(A, N, 0, N-1, i, 0);
cout << y << endl;
found[y] = true;
D[y] = i;
}
}
answer(A,D);
}
Compilation message
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:9: warning: unused variable 'cur' [-Wunused-variable]
35 | int cur = 0;
| ^~~
cave.cpp:36:9: warning: unused variable 'tmp' [-Wunused-variable]
36 | int tmp = 0;
| ^~~
cave.cpp:37:9: warning: unused variable 'i' [-Wunused-variable]
37 | int i = 0;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
744 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
83 ms |
604 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
744 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |