이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
# pragma GCC optimize ("O3")
# pragma GCC optimize ("Ofast")
# pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define MEM 111111
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll MOD = 1e9+7;
const ll INF = 2e14+7;
ll mul(ll a, ll b){
return ((a*b)%MOD+MOD)%MOD;
}
ll add(ll a, ll b){
return ((a+b)%MOD+MOD)%MOD;
}
ll t,n,ans,m,q,k;
ll v[MEM];
long long count_swaps(std::vector<int> s) {
ll n=s.sz;
ll ans=0;
for(int i=n-1; i>=0; i--){
if(v[i]) continue;
ll o=0;
for(int j=i-1; j>=0; j--){
if(v[j]) {
o++;
continue;
}
if(-s[j]==s[i]){
if(s[i]>0) ans += i-j-1-o;
else ans += i-j-o;
v[j] = 1;
v[i] = 1;
break;
}
}
//cout << i << ' ' << o << ' ' << ans << '\n';
}
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... |