제출 #154821

#제출 시각아이디문제언어결과실행 시간메모리
154821Nightlight동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>

bool found[70005], ketemu;
bool ANS[70005];

int binser1(){
	int l = 0, r = N-1, res = -1;
	while(l <= r){
		int mid = (l+r)/2;
		int tmp[N];
		for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 1 : 0;
		if(tryCombination(tmp[]) > ketemu){
			r = mid+1;
			ans = mid;
		}else  = mid;
	}
	return res;
}

int binser2(){
	int l = 0, r = N-1, res = -1;
	while(l <= r){
		int mid = (l+r)/2;
		int tmp[N];
		for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 0 : 1;
		if(tryCombination(tmp[]) > ketemu){
			r = mid+1;
			ans = mid;
		}else  = mid;
	}
	return res;
}


void exploreCave(int N) {
	bool Switch[N];
	int door[N];
	for(ketemu = 0; ketemu < N; ketemu++){
		int res = binser1();
		if(res != -1){
			door[ketemu] = res;
			ANS[res] = 1;
			found[res] = 1;
			Switch[res] = 1;
			continue;
		}
		res = binser2();
		door[ketemu] = res;
		Switch[res] = 1;
		found[res] = 1;
	}
    answer(int Switch[], int door[]);
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'int binser1()':
cave.cpp:8:17: error: 'N' was not declared in this scope
  int l = 0, r = N-1, res = -1;
                 ^
cave.cpp:12:29: error: 'tmp' was not declared in this scope
   for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 1 : 0;
                             ^~~
cave.cpp:12:29: note: suggested alternative: 'tm'
   for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 1 : 0;
                             ^~~
                             tm
cave.cpp:13:21: error: 'tmp' was not declared in this scope
   if(tryCombination(tmp[]) > ketemu){
                     ^~~
cave.cpp:13:21: note: suggested alternative: 'tm'
   if(tryCombination(tmp[]) > ketemu){
                     ^~~
                     tm
cave.cpp:13:25: error: expected primary-expression before ']' token
   if(tryCombination(tmp[]) > ketemu){
                         ^
cave.cpp:15:4: error: 'ans' was not declared in this scope
    ans = mid;
    ^~~
cave.cpp:15:4: note: suggested alternative: 'abs'
    ans = mid;
    ^~~
    abs
cave.cpp:16:10: error: expected primary-expression before '=' token
   }else  = mid;
          ^
cave.cpp:18:9: error: 'res' was not declared in this scope
  return res;
         ^~~
cave.cpp: In function 'int binser2()':
cave.cpp:22:17: error: 'N' was not declared in this scope
  int l = 0, r = N-1, res = -1;
                 ^
cave.cpp:26:29: error: 'tmp' was not declared in this scope
   for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 0 : 1;
                             ^~~
cave.cpp:26:29: note: suggested alternative: 'tm'
   for(int i = 0; i < N; i++)tmp[i] = (l <= i && mid >= i) ? 0 : 1;
                             ^~~
                             tm
cave.cpp:27:21: error: 'tmp' was not declared in this scope
   if(tryCombination(tmp[]) > ketemu){
                     ^~~
cave.cpp:27:21: note: suggested alternative: 'tm'
   if(tryCombination(tmp[]) > ketemu){
                     ^~~
                     tm
cave.cpp:27:25: error: expected primary-expression before ']' token
   if(tryCombination(tmp[]) > ketemu){
                         ^
cave.cpp:29:4: error: 'ans' was not declared in this scope
    ans = mid;
    ^~~
cave.cpp:29:4: note: suggested alternative: 'abs'
    ans = mid;
    ^~~
    abs
cave.cpp:30:10: error: expected primary-expression before '=' token
   }else  = mid;
          ^
cave.cpp:32:9: error: 'res' was not declared in this scope
  return res;
         ^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:36: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
  for(ketemu = 0; ketemu < N; ketemu++){
                                    ^~
cave.cpp:53:12: error: expected primary-expression before 'int'
     answer(int Switch[], int door[]);
            ^~~
cave.cpp:53:26: error: expected primary-expression before 'int'
     answer(int Switch[], int door[]);
                          ^~~