이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s) {
int n = s.size() / 2;
int ans = 0;
for(int pos = 0;pos < n;pos++){
int anchor = s[2*pos];
for(int i = 2*pos+1;i < 2*n;i++){
if(s[i] + anchor == 0){
int x = i;
while(x > 2*pos+1){
swap(s[x],s[x-1]);
ans++;
x--;
}
if(anchor > 0){
swap(s[pos*2],s[pos*2+1]);
ans++;
}
break;
}
}
for(int i = 0;i < 2 * n;i++){
//cout << s[i] << " ";
}
//cout << "\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... |