# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72099 | BBBSNG (#118) | Judge Against Wrong Code (FXCUP3_judge) | C++17 | 0 ms | 0 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 y = 0, n;
void yeah(int x, int y)
{
Report(x, y);
}
void f(int s, int e)
{
if(s == e) yeah(s, s);
int a = Detect(s, s);
int b = Detect(e, e);
if(a == 1 && b == 1){
int c = Detect(s, e);
if(c == 1) yeah(e, s);
else yeah(s, e);
}
else if(a == 1){
int i, j;
for(i=s+1; i<e; i++) if(Detect(i, i)) break;
//(s, i) or (i, s)
for(j=1; j<=n; j++) if(j != s && j != i) break;
if(Detect(s, j)) yeah(s, i);
else yeah(i, s);
}
else if(b == 1){
int i, j;
for(i=s+1; i<e; i++) if(Detect(i, i)) break;
//(e, i) or (i, e)
for(j=1; j<=n; j++) if(j != e && j != i) break;
if(Detect(e, j)) yeah(e, i);
else yeah(i, e);
}
else{
if(s + 1 == e){
int i;
for(i=1; i<=n; i++) if(i != s && i != e) break;
if(Detect(s, i)) Report(s, s);
else Report(e, e);
return;
}
int c = Detect(s, e);
if(c == 1){
int i;
for(i=1; i<=n; i++) if(i != s && i != e) break;
if(Detect(s, i)) Report(s, s);
else Report(e, e);
}
else f(s + 1, e - 1);
}
}
void FindTreasure(int N) { n = N; f(1, N); }