Submission #836220

#TimeUsernameProblemLanguageResultExecution timeMemory
836220DenkataArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "shoes.h" #include "grader.cpp" using namespace std; const int maxn = 1e5; const int inf = 3e5+3; long long i,j,ans,p,q,b[inf],n; vector <int> v; deque <int> pos[inf]; void upd(int p) { while(p<=n) { b[p]++; p = (p|(p+1)); } } long long rsq(int p) { long long sum = 0; while(p>=0) { sum+=b[p]; p = ((p&(p+1))-1); } return sum; } long long count_swaps(vector<int> s) { ans = 0; j = 1; n = (int)s.size()*4+1; //memset(pos,-1,sizeof(pos)); for(auto i:s) { if(!pos[-i+maxn].empty()) { if(i>0) v.push_back(pos[-i+maxn].front()+1),pos[-i+maxn].pop_front(); else v.push_back(pos[-i+maxn].front()-1),pos[-i+maxn].pop_front(); } else { if(i>0) pos[i+maxn].push_back(j+1),v.push_back(j+1); else pos[i+maxn].push_back(j),v.push_back(j); } j+=2; } j = 0; for(auto i:v) { // cout<<i<<endl; ans+=j-rsq(i); upd(i); j++; } return ans; } /** 2 -2 -2 2 2 2 2 1 -1 -2 */

Compilation message (stderr)

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