제출 #784132

#제출 시각아이디문제언어결과실행 시간메모리
784132AlfraganusArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
// #include "shoes.h"
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;

long long count_swaps(vector<int> a) {
	long long n = a.size() / 2;
	if(n == 1)return a[0] > 0;
	vector<vector<int>> pos(2 * n + 1);
	for(int i = 2 * n - 1; i >= 0; i --)
		pos[a[i] + n].push_back(i);
	long long ans = 0;
	for(int i = 0; i < 2 * n; i ++){
		if(a[i] != 0){
			ans += pos[-a[i] + n].back() - i;
			if(a[i] < 0)ans --;
			a[pos[-a[i] + n].back()] = 0;
			pos[-a[i] + n].pop_back();
			pos[a[i] + n].pop_back();
			a[i] = 0;
		}
	}
	return ans;
}

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

/usr/bin/ld: /tmp/cczSArvX.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccsAd9RV.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status