Submission #72216

# Submission time Handle Problem Language Result Execution time Memory
72216 2018-08-26T06:05:03 Z um..(#2163, grape, sssyyy, arpiel0610) Magic Dowsing (FXCUP3_magic) C++17
Compilation error
0 ms 0 KB
#include "dowsing.h"


void FindTreasure(int N) {

	int map[105][105];
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			map[i][j] = -1;

	int on = 0, oa = 0, ot = 0, zn = 0;
	for (int i = 1; i < N; i++) {
		map[i][i] = Detech(i, i);
		if (map[i][i] == 0) {
			zn++;
		}
		else {
			on++;
			if (on == 1) oa = i;
			else {
				ot = i;
				break;
			}
		}
	}

	int chk = 0;
	if (on == 0) {
		int ans = 0;
		for (int i = 1; i <= N - 3; i += 2) {
			map[i][i + 1] = Detech(i, i + 1);
			if (map[i][i + 1] == 1) {
				ans = i;
				break;
			}
		}
		if (ans == 0) ans = N - 1;

		chk = ans - 1;
		if (chk == 0) chk = N;
		if (Detech(chk, ans) == 1) Report(ans, ans);
		else Report(ans + 1, ans + 1);
	}
	else {
		if (on == 1) ot = N;

		for (int i = 1; i <= N; i++) {
			if (i != oa && i != ot) {
				if (Detech(i, oa) == 1) Report(ot, oa);
				else Report(oa, ot);
			}
		}
	}
}

Compilation message

dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:13:15: error: 'Detech' was not declared in this scope
   map[i][i] = Detech(i, i);
               ^~~~~~
dowsing.cpp:13:15: note: suggested alternative: 'Detect'
   map[i][i] = Detech(i, i);
               ^~~~~~
               Detect
dowsing.cpp:31:20: error: 'Detech' was not declared in this scope
    map[i][i + 1] = Detech(i, i + 1);
                    ^~~~~~
dowsing.cpp:31:20: note: suggested alternative: 'Detect'
    map[i][i + 1] = Detech(i, i + 1);
                    ^~~~~~
                    Detect
dowsing.cpp:41:7: error: 'Detech' was not declared in this scope
   if (Detech(chk, ans) == 1) Report(ans, ans);
       ^~~~~~
dowsing.cpp:41:7: note: suggested alternative: 'Detect'
   if (Detech(chk, ans) == 1) Report(ans, ans);
       ^~~~~~
       Detect
dowsing.cpp:49:9: error: 'Detech' was not declared in this scope
     if (Detech(i, oa) == 1) Report(ot, oa);
         ^~~~~~
dowsing.cpp:49:9: note: suggested alternative: 'Detect'
     if (Detech(i, oa) == 1) Report(ot, oa);
         ^~~~~~
         Detect