제출 #656205

#제출 시각아이디문제언어결과실행 시간메모리
656205srlabibArranging Shoes (IOI19_shoes)C++17
10 / 100
1091 ms1876 KiB
/****Bismillahir rahmanir rahim****/

#include<bits/stdc++.h>

using namespace std;

typedef long long            ll;
typedef long double          ld;
typedef vector<int>          vi;
typedef vector<long long>    vl;
typedef vector<double>       vd;

#define All(a) a.begin(),a.end()

template <typename T>
void get_vector(T &a)
{
    for(auto &e: a) cin >> e;
}

template <typename T>
void put_vector(T a)
{
    for(auto e :a)cout << e << " ";
    cout << endl;
}

int count_swaps(vector<int> S)
{
    int n = S.size();
    vector<bool>check(n);
    int ans = 0;
    for(int i = 0; i<n; i++){
        if(check[i])continue;
        check[i] = 1;
        int x = 0;
        if(S[i]>0)x++;
        for(int j= i+1; j<n; j++){
            if(S[j]==S[i]*(-1)){
                check[j] = 1;
                ans+=x;
                break;
            }
            if(check[j])continue;
            x++;
        }
    }
    return ans;
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...