Submission #534802

#TimeUsernameProblemLanguageResultExecution timeMemory
534802andecaandeciArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; typedef int ll; typedef double db; #define pairll pair<ll,ll> #define lpairll pair<pairll,ll> #define pb push_back #define mp make_pair #define fr first #define sc second #define repp(i,a,b) for(ll i = (a); i <= (b); i++) #define repm(i, a, b) for (ll i = (a); i >= (b); i--) #define repz(i, a, b) for (ll i = (a); i < (b); i++) const ll MOD = 1e9+7, N = 2e5 + 5, M = 4e5+5, C = 1e5; ll tc = 1, n, m=0, ar[N], tree[M]; string s, ye = "YES", no = "NO"; queue<ll> loc[N]; void fastt(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } ll query(ll nw, ll l, ll r, ll x, ll y){ if(l > y || r < x) return 0; if(l >= x && r <= y) return tree[nw]; ll mid = (l+r)/2; return query(nw*2,l,mid,x,y) + query(nw*2+1,mid+1,r,x,y); } void upd(ll nw, ll l, ll r, ll idx){ if(l == r){ tree[nw] = 1; return; } ll mid = (l+r)/2; if (idx <= mid) upd(nw*2,l,mid,idx); else upd (nw*2+1,mid+1,r,idx); tree[nw] = tree[nw*2] + tree[nw*2+1]; } ll count_swaps(vector<ll> v){ vector<ll> t; ll n = v.size(); t.pb(0); for (auto i : v) t.pb(i); v = t; repz(i,1,v.size()){ loc[v[i]+C].push(i); } ll ans = 0; memset(tree,0,sizeof(tree)); repz(i,1,v.size()){ if(loc[v[i]+C].size() <= 0) continue; ll ed = (v[i] > 0), nx; nx = loc[C-v[i]].front(); loc[C-v[i]].pop(); loc[C+v[i]].pop(); ed += nx-i-1; ed -= query(1,1,n,i+1,nx-1); upd(1,1,n,i); ans += ed; } //cout << ans << endl; return ans; } // int main(){ // // freopen("input.txt", "r", stdin); // //freopen("output.txt", "w", stdout); // fastt(); // //cin >> tc; // while(tc--){ // cin >> n; // vector<ll> v; // while(n--){ // cin >> m; // v.pb(m); // } // count_swaps(v); // } // } /* */

Compilation message (stderr)

shoes.cpp:48:4: error: ambiguating new declaration of 'll count_swaps(std::vector<int>)'
   48 | ll count_swaps(vector<ll> v){
      |    ^~~~~~~~~~~
In file included from shoes.cpp:2:
shoes.h:7:11: note: old declaration 'long long int count_swaps(std::vector<int>)'
    7 | long long count_swaps(std::vector<int> S);
      |           ^~~~~~~~~~~
shoes.cpp: In function 'll count_swaps(std::vector<int>)':
shoes.cpp:16:42: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | #define repz(i, a, b) for (ll i = (a); i < (b); i++)
      |                                          ^
shoes.cpp:54:3: note: in expansion of macro 'repz'
   54 |   repz(i,1,v.size()){
      |   ^~~~
shoes.cpp:16:42: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | #define repz(i, a, b) for (ll i = (a); i < (b); i++)
      |                                          ^
shoes.cpp:59:3: note: in expansion of macro 'repz'
   59 |   repz(i,1,v.size()){
      |   ^~~~