Submission #159395

#TimeUsernameProblemLanguageResultExecution timeMemory
159395David_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 (int i=x; i<=N; i+=i&(-i)) F[i]++; }
int  get(int x){ for (int 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 'int get(int)':
shoes.cpp:9:59: error: 'a' was not declared in this scope
 int  get(int x){ for (int 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);
             ^