제출 #314193

#제출 시각아이디문제언어결과실행 시간메모리
314193ShiftyBlockArranging Shoes (IOI19_shoes)C++14
컴파일 에러
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:2:17: error: 'vector' was not declared in this scope
    2 | int count_swaps(vector<int> arr){
      |                 ^~~~~~
shoes.cpp:2:24: error: expected primary-expression before 'int'
    2 | int count_swaps(vector<int> arr){
      |                        ^~~