Submission #852301

#TimeUsernameProblemLanguageResultExecution timeMemory
852301teo_thrashArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.cpp" #include<bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn=2e5+5; int bit[maxn]; void update(int idx, int delta){ for(; idx<maxn; idx += (idx & -idx)){ bit[idx]+=delta; } } ll query(int idx){ ll sum=0; for(; idx>0; idx -= (idx & -idx)){ sum+=bit[idx]; } return sum; } ll query(int l, int r){ return query(r)-query(l-1); } ll count_swaps( vector<int> a){ ll ans; vector<pii> shoes[maxn]; int n=a.size(); for(int i=0; i<n; i++){ shoes[abs(a[i])].pb({a[i], i}); } vector<pii> pairs; for(int i=1; i<=a.size()/2; i++){ sort(shoes[i].begin(), shoes[i].end()); for(int j=0; j<shoes[i].size()/2; j++){ int l=shoes[i][j].second; int r=shoes[i][j + (shoes[i].size()/2) ].second; if(l>r){ swap(l, r); ans++; } pairs.pb({l, r}); } } for(int i=1; i<=a.size(); i++){ update(i, 1); } sort(pairs.begin(), pairs.end()); for(auto p: pairs){ ans+=query(p.first, p.second); update(p.first, -1); update(p.second, -1); } return ans; }

Compilation message (stderr)

shoes.cpp:1:10: fatal error: shoes.cpp: No such file or directory
    1 | #include "shoes.cpp"
      |          ^~~~~~~~~~~
compilation terminated.