제출 #225733

#제출 시각아이디문제언어결과실행 시간메모리
225733grtArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define PB push_back #define ST first #define ND second #define _ ios_base::sync_with_stdio(0); cin.tie(0); //mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; const int nax = 100*1000+10; int T[(1<<19)],R; vi lft[nax],rght[nax]; int nxt[2*nax]; void update(int a,int x) { a+=R; T[a] += x; while(a>1) { a/=2; T[a] = T[2*a] + T[2*a+1]; } } int query(int a,int b) { a+=R; b+=R; if(a > b) return 0; int w = T[a] + (a!=b?T[b]:0); while(a/2!=b/2) { if(a%2==0) w+=T[a+1]; if(b%2==1) w+=T[b-1]; a/=2; b/=2; } return w; } ll count_swaps(vector<int> t) { int n = t.size(); R = 1; ll ans = 0; while(R < n) R*=2; for(int i = 0; i < n; ++i) { if(t[i] < 0) { lft[-t[i]].PB(i); } else { rght[t[i]].PB(i); } } for(int i = 1; i <= n/2; ++i) { for(int j = 0; j < (int)lft[i].size(); ++j) { ans += (lft[i][j] > rght[i][j]); nxt[min(lft[i][j],rght[i][j])] = max(lft[i][j],rght[i][j]); } } for(int i = 0; i < n; ++i) { if(nxt[i] == 0) continue; ans += nxt[i] - i - 1 - query(i+1,nxt[i]-1); update(nxt[i],1); } return ans; } int main() { //~ cout << count_swaps({2,1,-1,-2}); }

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

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