# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74344 | khsoo01 | Magic Dowsing (FXCUP3_magic) | C++11 | 3 ms | 380 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |