Submission #301735

#TimeUsernameProblemLanguageResultExecution timeMemory
301735letandatArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
 
int main () {
	int n;
	int a[1000000];
	cin >> n;
	for (int i=0; i<2*n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i=0; i<2*n-1; i+=2) {
		if (abs(a[i])==abs(a[i+1])) continue;
		for (int j=i+2; j<2*n; j++) {
			if (abs(a[j]) == abs(a[i])) {
				ans += j-i-1;
				for (int k=j; k>=i+2; k--) {
					a[k] = a[k-1];
				}
				a[i+1] = a[i];
			}
		}
	}
	for (int i=0; i<2*n-1; i+=2) {
		if (a[i] > 0) ans += 1;
	}
	cout << ans;
	return 0;
}

Compilation message (stderr)

/tmp/cclXAfcm.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc8UIcqP.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/cclXAfcm.o: In function `main':
grader.cpp:(.text.startup+0x26a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status