제출 #72095

#제출 시각아이디문제언어결과실행 시간메모리
72095유애나 (#118)마법 다우징 (FXCUP3_magic)C++17
60 / 100
3 ms376 KiB
#include "dowsing.h"
#include <vector>
using namespace std;

void FindTreasure(int N) {
	vector<int> v;
	for(int i = 1; i <= N; i++){
		if(Detect(i, i)) v.push_back(i);
	}
	if(v.empty()){
		for(int i = 2; i <= N; i += 2){
			if(Detect(i - 1, i)){
				if(Detect(i - 1, (i == 2 ? N : 1))) Report(i - 1, i - 1);
				else Report(i, i);
				return;
			}
		}
		Report(N, N);
	}
	else{
		if(Detect(v[0], (v[0] == 1 ? (v[1] == N ? 2 : N) : 1))) Report(v[0], v[1]);
		else Report(v[1], v[0]);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...