제출 #314194

#제출 시각아이디문제언어결과실행 시간메모리
314194ShiftyBlockArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
int count_swaps(vector<int> arr){
	int N=arr.size();
	int total=0;
    for (int i = 0; i < N; ++i)
    {
    	if(arr[i]==0) continue;
    	int free=0;
    	int end=-1;
    	rep(j,i+1,N){
    		if(arr[j]==-arr[i]){
    			end=j; break;
    		}
    		if(arr[j]==0) free++;
    	}	
    	arr[end]=0;
    	if(arr[i]<0) total--;
    	total+=end-i;
    }
    return total;
}

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

shoes.cpp:1:17: error: 'vector' was not declared in this scope
    1 | int count_swaps(vector<int> arr){
      |                 ^~~~~~
shoes.cpp:1:24: error: expected primary-expression before 'int'
    1 | int count_swaps(vector<int> arr){
      |                        ^~~