Submission #72341

# Submission time Handle Problem Language Result Execution time Memory
72341 2018-08-26T07:18:54 Z Semteo For Ajou(#2257, tph00300, txepahs, bmw) Magic Dowsing (FXCUP3_magic) C++17
0 / 100
2 ms 256 KB
#include "dowsing.h"

void FindTreasure(int N) {
	int i, j;

	int m = 0, arr[3] = { 0 };
	for (i = 1; i <= N; i++)
	{
		if (Detect(i, i) == 1)
		{
			m++;
			arr[m] = i;
		}
	}
	if (m == 2)
	{
		if (Detect(arr[1], arr[2]) == 0)
			Report(arr[1], arr[2]);
		else
			Report(arr[2], arr[1]);
	}
	else if (m == 0)
	{
		int flag = 0;
		for (i = 1; i <= N; i++)
		{
			if (Detect(i, 1) == 1)
			{
				flag = 1;
				Report(i, i);
				return;
			}
		}
		if (flag == 0)
			Report(1, 1);
	}
}

Compilation message

dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:4:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j;
         ^
# 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 -