# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
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;
}
# | 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... |