Submission #159394

#TimeUsernameProblemLanguageResultExecution timeMemory
159394David_MArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> #define ll long long using namespace std; queue<int> q[200005]; vector <int> F(100005); ll ans,N,j; void upd(int x){ for (i=x; i<=N; i+=i&(-i)) F[i]++; } int get(int x){ for (i=x, ans=0; i; i-=i&(-i))ans+=F[a]; return ans;} ll count_swaps(vector<int> V){N=V.size()/2; for (int i=0, j; i<2*N; i++){ if(v[N-S[i]].empty()) j=i+1, v[N+S[i]].push(j); else j=v[N-S[i]].front(), v[N-S[i]].pop(), ans+=(i-get(j))+((abs(V[i])/V[i]-1)*(-1)/2); upd(j); } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'void upd(int)':
shoes.cpp:8:23: error: 'i' was not declared in this scope
 void upd(int x){ for (i=x; i<=N; i+=i&(-i)) F[i]++; }
                       ^
shoes.cpp: In function 'int get(int)':
shoes.cpp:9:23: error: 'i' was not declared in this scope
 int  get(int x){ for (i=x, ans=0; i; i-=i&(-i))ans+=F[a]; return ans;}
                       ^
shoes.cpp:9:55: error: 'a' was not declared in this scope
 int  get(int x){ for (i=x, ans=0; i; i-=i&(-i))ans+=F[a]; return ans;}
                                                       ^
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:12:9: error: 'v' was not declared in this scope
      if(v[N-S[i]].empty()) j=i+1, v[N+S[i]].push(j);
         ^
shoes.cpp:12:13: error: 'S' was not declared in this scope
      if(v[N-S[i]].empty()) j=i+1, v[N+S[i]].push(j);
             ^