#include "dowsing.h"
#include<bits/stdc++.h>
using namespace std;
vector<tuple<int,int> >V;
void FindTreasure(int N) {
for(int i=1;i<=N;i++)
if(Detect(i,i))
V.push_back(tie(i,i));
if(V.size()==2)
{
for(int i=get<0>(V[0])-1;i<=get<0>(V[1])+1;i++)
if(i!=get<0>(V[0])&&i!=get<0>(V[1])&&0<i&&i<=N)
{
if(Detect(i,get<1>(V[0])+1))
Report(get<0>(V[0]),get<1>(V[1]));
else
Report(get<0>(V[1]),get<1>(V[0]));
break;
}
}
else
{
int rep=0;
for(int r=1,c=2;!rep&&c<=N-1;r+=2,c+=2)
{
if(Detect(r,c))
{
for(int i=r-1;i<=r+2;i++)
if(i!=r&&i!=r+1&&1<=i&&i<=N)
{
if(Detect(i,c))
Report(r+1,c);
else
Report(r,c-1);
rep=1;
break;
}
}
}
if(!rep)
{
if(Detect(1,N))
Report(N,N);
else
Report(N-1,N-1);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Correct : C = 5 |
2 |
Runtime error |
2 ms |
376 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |