Submission #1274229

#TimeUsernameProblemLanguageResultExecution timeMemory
1274229gazizmadi11Arranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "shoes.h"
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define tm (tl+tr)/2
#define TL v+v, tl, tm
#define TR v+v+1, tm+1, tr
#define DA l <= tl && tr <= r
#define NE r < tl || tr < l
#define double long double
// #define int long long 
using namespace std;
 
const int N=2e5+7;
const int mod=998244353;
const int inf=2e9;

int count_swaps(vector<int>S){
    vector<int>a[S.size()+1];
    vector<int>b[S.size()+1];
    int ans=0;
    for(int i=0; i < S.size(); i++){
        int x = S[i];
        if(x > 0){
            if(a[x].size()){
                ans+=i-a[x].back()-1;
                a[x].pop_back();
            }
            else b[x].pb(i);
        }
        else{
            if(b[x].size()){
                ans+=i-b[x].back();
                b[x].pop_back();
            }
            else a[x].pb(i);
        }
    }
    return ans;
}

// void solve(){
    
// }

// signed main(){
 
//     ios_base::sync_with_stdio(0);
//     cin.tie(0);
//     int dioz=1;
//     cin >> dioz; 	
//     while(dioz--)solve();
    
// return 0;
// }

Compilation message (stderr)

shoes.cpp:22:5: error: ambiguating new declaration of 'int count_swaps(std::vector<int>)'
   22 | int count_swaps(vector<int>S){
      |     ^~~~~~~~~~~
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);
      |           ^~~~~~~~~~~