이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define forn(j, i, n) for(int i = j; i <= n; ++i)
#define FOR(j, i, n) for(int i = j; i < n; ++i)
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
long long count_swaps(std::vector<int> s)
{
int n = s.size()/2;
vector <int> del(2*n, 0);
ll ans = 0;
FOR(0, i, 2*n)
{
if(del[i]) continue;
int deleted = 0;
FOR(i + 1, j, 2*n)
{
if(del[j]) deleted++;
if(s[i] == -s[j])
{
ans += j - i - deleted - (s[i] < 0);
del[j] = 1;
break;
}
}
}
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... |