Submission #537325

#TimeUsernameProblemLanguageResultExecution timeMemory
537325ERHArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; vector<int> lista[200001]; int temp[200001]; long long count_swaps(vector<int> v){ long long int total=0, z=v.size(); for(int i=0; i<z; ++i){ int a=v[i]; if(a<0){ if(!lista[-a+z].empty()){ int temp1=i+1, temp2=lista[-a+z].front(); for(int j=i+1; j>0; j-=j&-j){ temp1+=temp[j]; } temp1+=temp[0]; for(int j=lista[-a+z].front(); j>0; j-=j&-j){ temp2+=temp[j]; } temp2+=temp[0]; total+=temp1-temp2; for(int j=lista[-a+z].front(); j<200001; j+=j&-j){ temp[j]++; } for(int j=i+1; j<200001; j+=j&-j){ temp[j]--; } lista[-a+z].erase(lista[-a+z].begin()); } else { lista[a+z].push_back(i+1); } } else { if(!lista[-a+z].empty()){ int temp1=i+1, temp2=lista[-a+z].front(); for(int j=i+1; j>0; j-=j&-j){ temp1+=temp[j]; } temp1+=temp[0]; for(int j=lista[-a+z].front(); j>0; j-=j&-j){ temp2+=temp[j]; } temp2+=temp[0]; total+=temp1-temp2; total--; for(int j=lista[-a+z].front(); j<200001; j+=j&-j){ temp[j]++; } for(int j=i+1; j<200001; j+=j&-j){ temp[j]--; } lista[-a+z].erase(lista[-a+z].begin()); } else { lista[a+z].push_back(i+1); } } } return total; } int main(){ cout<<count_swaps({2, -2, 2, -2}); }

Compilation message (stderr)

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