#include "dowsing.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
mt19937 rd((unsigned)chrono::steady_clock::now().time_since_epoch().count());
inline int ask(int x, int y)
{
return Detect(x, y);
}
void FindTreasure(int n)
{
int i, j, k=1, arr[101];
bool chk[101];
memset(chk, 0, sizeof(chk));
vector<int> v;
for(i=1;i<=n;i++)
if(ask(i, i)) v.push_back(i);
if(v.size()==2)
{
i=v[0];j=v[1];
if(i==k) k=2;
if(j==k) k=3;
if(ask(k, j))
{
Report(i, j);
return;
}
Report(j, i);
return;
}
for(i=1;i<(n+1)/2;i++)
if(ask(2*i-1, 2*i)) break;
if(2*i-1==k) k=3;
if(ask(k, 2*i-1))
{
Report(2*i-1, 2*i-1);
return;
}
Report(2*i, 2*i);
return;
}
Compilation message
dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:13:20: warning: unused variable 'arr' [-Wunused-variable]
int i, j, k=1, arr[101];
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 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 |
376 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 |