Submission #71967

# Submission time Handle Problem Language Result Execution time Memory
71967 2018-08-26T04:17:32 Z End Time(#2161, dotorya, zigui) Magic Dowsing (FXCUP3_magic) C++17
0 / 100
2 ms 256 KB
#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
1 Runtime error 2 ms 256 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -