# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97362 | ahgus89 | Magic Dowsing (FXCUP3_magic) | C++14 | 3 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |