이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/****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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |