제출 #543074

#제출 시각아이디문제언어결과실행 시간메모리
543074Anas_AbuAmarArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s) {
   long long ans = 0;
   deque<int>d;
   for (auto &i:s){
      d.push_back(i);
   }
   while(!d.empty()){
      int cur = d.front();
      auto next = find(d.begin() , d.end() ,cur*-1);
      ans += (next-d.begin())-1;
      if (cur > 0 ){
         ans++;
      }
      d.erase(next);
      d.pop_front();
   }
   return ans;
}
int main() {
	int n;
	assert(1 == scanf("%d", &n));
	vector<int> S(2 * n);
	for (int i = 0; i < 2 * n; i++)
		assert(1 == scanf("%d", &S[i]));
	fclose(stdin);

	long long result = count_swaps(S);

	printf("%lld\n", result);
	fclose(stdout);
	return 0;
}

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

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