| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364669 | nataliaa | Arranging Shoes (IOI19_shoes) | C++20 | 1095 ms | 1960 KiB |
#include<bits/stdc++.h>
#include "shoes.h"
using namespace std;
const int MAXN = 200005;
// long long ok[MAXN] = {};
// void update(int idx, int val){
// while(idx<=MAXN){
// ok[idx]+=val;
// idx+=idx&(-idx);
// }
// }
// long long get(int idx){
// long long s= 0;
// while(idx>0){
// s+=ok[idx];
// idx-=idx&(-idx);
// }
// return s;
// }
long long count_swaps(vector<int> v) {
long long ans = 0;
for(int i = 0; i < v.size(); i+=2){
if(v[i]<0){
int ind = 0;
for(int j = i+1; j<v.size(); j++){
if(v[j]==-v[i]){
ind = j;
break;
}
}
while(ind>i+1){
swap(v[ind], v[ind-1]);
ind--;
ans++;
}
continue;
}
ans++;
int ind = 0;
for(int j = i+1; j<v.size(); j++){
if(v[j]==-v[i]){
ind = j;
break;
}
}
while(ind>i+1){
swap(v[ind], v[ind-1]);
ind--;
ans++;
}
continue;
}
return ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
