Submission #74344

#TimeUsernameProblemLanguageResultExecution timeMemory
74344khsoo01Magic Dowsing (FXCUP3_magic)C++11
100 / 100
3 ms380 KiB
#include "dowsing.h" #include<bits/stdc++.h> using namespace std; const int N = 105; int n, v[N]; void FindTreasure (int _N) { n = _N; bool D = false; for(int i=1;i<=n;i++) { v[i] = Detect(i, i); if(v[i]) D = true; } if(D) { vector<int> V; for(int i=1;i<=n;i++) { if(v[i]) V.push_back(i); } int A = V[0], B = V[1]; for(int i=1;i<=n;i++) { if(i != A && i != B) { if(Detect(i, A)) Report(B, A); else Report(A, B); return; } } } else { for(int i=1;i<=min(n/2, 49);i++) { if(Detect(2*i-1, 2*i)) { if(Detect(2*i, 2*i+1)) Report(2*i, 2*i); else Report(2*i-1, 2*i-1); return; } } for(int i=min(n/2, 49)*2+1;i<n;i++) { if(Detect(1, i)) { Report(i, i); return; } } Report(n, n); } }
#Verdict Execution timeMemoryGrader output
Fetching results...