Submission #774844

#TimeUsernameProblemLanguageResultExecution timeMemory
774844khshg동굴 (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
	vector<int> cor(N), DtoS(N), StoD(N);
	for(int i = 0; i < N; ++i) {
		bool f = (tryCombination(cor) == i);
		int tl = 0, tr = N - 1;
		while(tl < tr) {
			int tm = (tl + tr) / 2;
			vector<int> ask(N);
			for(int j = 0; j <= tm; ++j) {
				ask[j] = 1;
			}
			for(int j = 0; j < i; ++j) ask[DtoS[j]] = cor[DtoS[j]];
			bool F = (tryCombination(ask) == i);
			if(F == f) {
				tl = tm + 1;
			} else tr = tm;
		}
		DtoS[i] = tl;
		StoD[tl] = i;
		cor[tl] = !f;
	}
	answer(cor, StoD);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:8:28: error: cannot convert 'std::vector<int>' to 'int*'
    8 |   bool f = (tryCombination(cor) == i);
      |                            ^~~
      |                            |
      |                            std::vector<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:17:29: error: cannot convert 'std::vector<int>' to 'int*'
   17 |    bool F = (tryCombination(ask) == i);
      |                             ^~~
      |                             |
      |                             std::vector<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:26:9: error: cannot convert 'std::vector<int>' to 'int*'
   26 |  answer(cor, StoD);
      |         ^~~
      |         |
      |         std::vector<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[]);
      |             ~~~~^~~