Submission #261551

#TimeUsernameProblemLanguageResultExecution timeMemory
261551c4ts0up동굴 (IOI13_cave)C++17
Compilation error
0 ms0 KiB
void exploreCave(int n) {
	// disposicion final
	for (int i=0; i<n; i++) S[i] = 0;
	
	int puerta, res;
	while (puerta != -1) {
		
		/*//
		std::cerr << "S: ";
		for (int i=0; i<n; i++) std::cerr << S[i] << " ";
		std::cerr << std::endl;
		//*/
		
		puerta = tryCombination(S);
		
		//std::cerr << "Puerta = " << puerta << std::endl;
		
		if (puerta == -1) break;
		
		for (int i=0; i<n; i++) {
			S[i] = 1;
			res = tryCombination(S);
			//std::cerr << "res = " << res << std::endl;
			if (res <= puerta && res != -1) S[i] = 0;
			else break;
		}
	}
	
	// ya tenemos la combinacion correcta, ahora a identificar las puertas
	for (int i=0; i<n; i++) {
		S[i] = (S[i] == 0 ? 1 : 0);
		puerta = tryCombination(S);
		D[i] = puerta;
		S[i] = (S[i] == 0 ? 1 : 0);
	}
	
	answer(S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:3:26: error: 'S' was not declared in this scope
  for (int i=0; i<n; i++) S[i] = 0;
                          ^
cave.cpp:14:27: error: 'S' was not declared in this scope
   puerta = tryCombination(S);
                           ^
cave.cpp:14:12: error: 'tryCombination' was not declared in this scope
   puerta = tryCombination(S);
            ^~~~~~~~~~~~~~
cave.cpp:31:3: error: 'S' was not declared in this scope
   S[i] = (S[i] == 0 ? 1 : 0);
   ^
cave.cpp:32:12: error: 'tryCombination' was not declared in this scope
   puerta = tryCombination(S);
            ^~~~~~~~~~~~~~
cave.cpp:33:3: error: 'D' was not declared in this scope
   D[i] = puerta;
   ^
cave.cpp:37:9: error: 'S' was not declared in this scope
  answer(S, D);
         ^
cave.cpp:37:12: error: 'D' was not declared in this scope
  answer(S, D);
            ^
cave.cpp:37:2: error: 'answer' was not declared in this scope
  answer(S, D);
  ^~~~~~