제출 #266452

#제출 시각아이디문제언어결과실행 시간메모리
266452wdjpngArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define lint long long using namespace std; lint count_swaps(vector<int> s){ int n = s.size()/2; vector<set<int>>set(2*n+1); vector<bool>ignore(2*n); rep(i,2*n){ set[s[i]+n].insert(i); } int sum=0; vector<int>add(2*n); int curAdd=0; rep(i,2*n){ curAdd+=add[i]; sum+=curAdd; if(ignore[i]){continue;} int nearest=*set[-s[i]+n].begin(); set[-s[i]+n].erase(set[-s[i]+n].begin()); ignore[nearest]=true; curAdd--; add[nearest]++; if(s[i]>0){sum++;} sum+=nearest-i-1; } return sum; } signed main(){ int n; cin >> n; n*=2; vector<int>s(n); rep(i,n){cin>>s[i];} cout << count_swaps(s); }

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

/tmp/cc0P08Jx.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cckZqRjI.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status