#include "dowsing.h"
#include <vector>
using namespace std;
typedef pair<int, int> pii;
int getdiff(int x, int y) {
int t = 1;
if (x == 1 || y == 1) t = 2;
if (t == 2 && (x == 2 || y == 2)) t = 3;
return t;
}
void FindTreasure(int N) {
vector <int> Vu;
for (int i = 1; i <= N; i++) {
if (Detect(i, i)) Vu.push_back(i);
}
if (Vu.size() == 2) {
int t = getdiff(Vu[0], Vu[1]);
if (Detect(Vu[0], t)) Report(Vu[0], Vu[1]);
else Report(Vu[1], Vu[0]);
return;
}
int t1 = N - 1, t2 = N;
for (int i = 1; i <= N / 2 - 1; i++) {
t1 = i * 2 - 1, t2 = i * 2;
if (Detect(t1, t2)) break;
}
int x = getdiff(t1, t2);
if (Detect(t1, x)) Report(t1, t1);
else Report(t2, t2);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |