Submission #543693

#TimeUsernameProblemLanguageResultExecution timeMemory
543693nayhz동굴 (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h"

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll s[5005]; // switch
ll ans[5005];

void exploreCave(int n) {
	memset(ans, -1, sizeof(ans));

	ll l, r, mid;
	bool flag, idk;
	for (int i = 0; i < n; i++) {
		l = 0, r = n - 1;
		flag = (tryCombination(s) == i);

		while (l <= r) {
			mid = (l + r) / 2;

			for (int j = l; j <= mid; j++) if (ans[j] == -1) s[j] = 1;

			idk = (tryCombination(s) == i);

			if (flag == idk) l = mid + 1;
			else r = mid - 1;
		}
		ans[l] = i, s[l] = flag;
	}

	answer(s, ans);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:26: error: cannot convert 'long long int*' to 'int*'
   17 |   flag = (tryCombination(s) == i);
      |                          ^
      |                          |
      |                          long long int*
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:24:26: error: cannot convert 'long long int*' to 'int*'
   24 |    idk = (tryCombination(s) == i);
      |                          ^
      |                          |
      |                          long long int*
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:32:9: error: cannot convert 'long long int*' to 'int*'
   32 |  answer(s, ans);
      |         ^
      |         |
      |         long long int*
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~