Submission #71975

# Submission time Handle Problem Language Result Execution time Memory
71975 2018-08-26T04:26:52 Z BOJ 8481(#2179, veydpz, jh05013, 16silver) Magic Dowsing (FXCUP3_magic) C++17
0 / 100
2 ms 256 KB
#include "dowsing.h"
#include <cstdlib>
using namespace std;

void FindTreasure(int N) {
	int a[2], idx=0;
	int v[50]={0};
	for(int i=1;i<=N;i++){
		if(Detect(i,i)==1) a[idx++]=i;
	}
	if(idx==0){
		int tmp;
		for(int i=0;i<50;i++){
			do{
				tmp=rand()%50;
			} while(v[tmp] != 0);
			if(Detect(2*tmp+1,2*tmp+2)==1) break;
			v[tmp]=1;
		}
		int j=(tmp==0?3:1);
		if(Detect(2*tmp+1,j)==1) Report(2*tmp+1,2*tmp+1);
		else Report(2*tmp+2,2*tmp+2);
	}
	else{
		int i;
		for(i=1;i==a[0]||i==a[1];i++);
		if(Detect(a[0],i) == 1) Report(a[0],a[1]);
		else Report(a[1],a[0]);
	}
}
# 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 -