| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1165844 | SG2Alok | Arranging Shoes (IOI19_shoes) | C++20 | 1095 ms | 1864 KiB |
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s) {
long long ans = 0;
for(int i = 0; i < s.size(); i++){
if(s[i] < 0){
int pos = -1;
for(int j = i + 1; j < s.size(); j++){
if(s[j] == -s[i]){
pos = j;
break;
}
}
while(pos > i + 1){
swap(s[pos], s[pos - 1]);
pos--;
ans++;
}
i++;
} else if(s[i] > 0){
int pos = -1;
for(int j = i + 1; j < s.size(); j++){
if(s[j] == -s[i]){
pos = j;
break;
}
}
while(pos > i){
swap(s[pos], s[pos - 1]);
pos--;
ans++;
}
i++;
}
}
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... | ||||
