| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1263752 | piolk | Arranging Shoes (IOI19_shoes) | C++20 | 1096 ms | 2632 KiB |
#include <bits/stdc++.h>
using namespace std;
int64_t count_swaps(vector<int> S){
int n=S.size();
vector<bool> skip(n+1);
vector<int> newPos(n);
iota(newPos.begin(),newPos.end(),1);
int64_t swaps=0;
for (int i=0;i<n;i++){
if (skip[i]) continue;
int posNow=newPos[i];
int posNext;
for (int j=i+1;j<n;j++){
if (skip[j]) continue;
if (S[j]==S[i]*-1){
posNext=newPos[j];
skip[j]=true;
break;
}
newPos[j]++;
}
skip[i]=true;
swaps+=posNext-posNow-1;
if (S[i]>0) swaps++;
}
return swaps;
}| # | 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... | ||||
