# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72195 | 김동현보다 잘함 (#118) | Magic Dowsing (FXCUP3_magic) | C++17 | 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;
int mini(int a, int b) {
int arr[3] = {1,1,1};
arr[min(a,2)] = 0; arr[min(b,2)] = 0;
for (int i=0;i<3;i++)if (arr[i]) return i;
return 0;
}
void chk(int c, int d) {
if (c==d) Report(c+1,d+1);
else if (Detect(c+1,mini(c,d)+1)) Report(c+1,d+1);
else Report(d+1,c+1);
}
void rchk(int c, int d) {
if (c==d) Report(c+1,d+1);
else if (Detect(c+1,mini(c,d)+1)) Report(c+1,c+1);
else Report(d+1,d+1);
}
void FindTreasure(int N) {
int i, c = -1, d = -1;
for (i=0;i<N;i++){
if (Detect(i+1,i+1)) {
if (c<0) c = i;
else d = i;
}
}
if (c>=0) {
chk(c,d);
return;
}
for (i=0;i<(N-1)/2;i++) {
if (Detect(i+1,N-i)) {
rchk(i,N-1-i);
return;
}
}
rchk((N-1)/2,N-1-(N-1)/2);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |