# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71967 | End Time (#118) | 마법 다우징 (FXCUP3_magic) | C++17 | 2 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dowsing.h"
#include <vector>
using namespace std;
typedef pair<int, int> pii;
int getdiff(int x, int y) {
int t = 1;
if (x == 1 || y == 1) t = 2;
if (t == 2 && (x == 2 || y == 2)) t = 3;
return t;
}
void FindTreasure(int N) {
vector <int> Vu;
for (int i = 1; i <= N; i++) {
if (Detect(i, i)) Vu.push_back(i);
}
if (Vu.size() == 2) {
int t = getdiff(Vu[0], Vu[1]);
if (Detect(Vu[0], t)) Report(Vu[0], Vu[1]);
else Report(Vu[1], Vu[0]);
return;
}
int t1 = N - 1, t2 = N;
for (int i = 1; i <= N / 2 - 1; i++) {
t1 = i * 2 - 1, t2 = i * 2;
if (Detect(t1, t2)) break;
}
int x = getdiff(t1, t2);
if (Detect(t1, x)) Report(t1, t1);
else Report(t2, t2);
return;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |