Submission #97362

#TimeUsernameProblemLanguageResultExecution timeMemory
97362ahgus89Magic Dowsing (FXCUP3_magic)C++14
100 / 100
3 ms376 KiB
#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)

dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:13:20: warning: unused variable 'arr' [-Wunused-variable]
     int i, j, k=1, arr[101];
                    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...