#include "dowsing.h"
#include <bits/stdc++.h>
using namespace std;
void FindTreasure(int N) {
int R, C;
vector<int> vt;
for(int j = 1; j <= N; j++){
if(Detect(j, j)){
vt.push_back(j);
}
}
if(vt.size() == 0){
for(int j = 1; j < N / 2; j++){
if(Detect(j, N - j + 1)){
if((j == 1 && !Detect(2, j)) || !Detect(1, j)) Report(N - j + 1, N - j + 1);
else Report(j , j);
return;
}
}
if(N % 2 == 0){
if(Detect(1, N / 2)) Report(N / 2, N / 2);
else Report(N / 2 + 1, N / 2 + 1);
}
else{
if(Detect(1, N - N / 2 + 1)) Report(N - N / 2 + 1, N - N / 2 + 1);
else Report(N / 2, N / 2);
}
}
else{
int R = vt[0], C = vt[1];
bool f = false;
for(int i = 1; i <= 5; i++){
if(i == C) continue;
if(!Detect(R, i)){
f = true;
break;
}
}
if(f) swap(R, C);
Report(R, C);
}
}
Compilation message
dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:6:9: warning: unused variable 'R' [-Wunused-variable]
int R, C;
^
dowsing.cpp:6:12: warning: unused variable 'C' [-Wunused-variable]
int R, C;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
252 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |