#include "dowsing.h"
#include<vector>
using namespace std;
void FindTreasure(int N) {
int rem = 0;
vector<int> hubo;
for(int i=1; i<=N; ++i)
{
if(Detect(i, i))
hubo.push_back(i);
else
rem = i;
}
if(hubo.empty())
{
rem = N;
for(int i=0; i<(N-1)/2; ++i)
{
if(Detect(2*i+1, 2*i+2))
{
if(Detect(rem, 2*i+1))
Report(2*i+1, 2*i+1);
else
Report(2*i+2, 2*i+2);
return;
}
}
if(N%2==1) Report(N, N);
else
{
rem = 1;
if(Detect(rem, N)) Report(N, N);
else Report(N-1, N-1);
}
return;
}
else
{
int v1, v2;
int r = hubo[0], c = hubo[1];
if(Detect(r, rem)) v1 = r; else v1 = c;
if(Detect(rem, r)) v2 = r; else v2 = c;
Report(v1, v2);
return;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Correct : C = 5 |
2 |
Correct |
2 ms |
252 KB |
Correct : C = 5 |
3 |
Correct |
3 ms |
376 KB |
Correct : C = 149 |
4 |
Correct |
3 ms |
376 KB |
Correct : C = 101 |
5 |
Correct |
3 ms |
376 KB |
Correct : C = 150 |
6 |
Correct |
3 ms |
376 KB |
Correct : C = 102 |
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 |