#include "dowsing.h"
void FindTreasure(int N) {
int i, j, c1 = -1, c2 = -1, c3 = -1;
for (i = 1; i <= N; i++) {
if (Detect(i, i)) {
if (c1 == -1)c1 = i;
else c2 = i;
}
else {
c3 = i;
}
}
if (c1 != -1) {
if (Detect(c1, c3)) {
Report(c1, c2);
}
else Report(c2, c1);
return;
}
for (i = 1; i < N - 1; i += 2) {
if (Detect(i, i + 1)) {
for (j = 1; j <= N; j++) {
if (i != j &&i + 1 != j) {
if (Detect(i, j)) {
Report(i, i);
}
else {
Report(i + 1, i + 1);
}
return;
}
}
}
}
if (N % 2 == 1) {
Report(N, N);
}
else {
if (Detect(1, N))Report(N, N);
else Report(N - 1, N - 1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Correct : C = 5 |
2 |
Correct |
2 ms |
256 KB |
Correct : C = 4 |
3 |
Correct |
3 ms |
376 KB |
Correct : C = 149 |
4 |
Correct |
3 ms |
376 KB |
Correct : C = 100 |
5 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
6 |
Correct |
3 ms |
424 KB |
Correct : C = 101 |
7 |
Correct |
3 ms |
376 KB |
Correct : C = 149 |
8 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
9 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
10 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
11 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
12 |
Correct |
3 ms |
376 KB |
Correct : C = 149 |