# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72403 | cat > /dev/null (#118) | Magic Dowsing (FXCUP3_magic) | C++17 | 3 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dowsing.h"
#include<queue>
using namespace std;
void FindTreasure(int N) {
queue<int> q;
for (int i = 1; i < N; i ++)
if (Detect(i, i)) {
q.push(i);
}
if (q.size() == 1)
q.push(N);
if (q.size() == 2) {
int i, j;
i = q.front(); q.pop();
j = q.front();
int t = j + 1;
if (t > N)
t = 1;
if (t == i)
t = j - 1;
if (t == 0)
t = N;
if (Detect(t, j))
Report(i, j);
else
Report(j, i);
return;
}
else {
for (int i = N, j = 1; j <= N/2; i --, j ++) {
if (Detect(i, j)) {
int t = i + 1;
if (t > N)
t = 1;
if (t == j)
t = i - 1;
if (t == 0)
t = N;
if (Detect(i, t))
Report(i, i);
else
Report(j, j);
return;
}
}
Report((N+1)/2, (N+1)/2);
}
return;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |