# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289887 | evpipis | Arranging Shoes (IOI19_shoes) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int len = 2e5+5;
int vis[len];
ll count_swaps(vector<int> shoe) {
ll ans = 0;
for (int i = 0; i < shoe.size(); i++){
if (vis[i]) continue;
int j = i+1, cnt = 0;
while (shoe[j] != -shoe[i])
cnt += (!vis[j]), j++;
ans += cnt + (shoe[i] > 0);
vis[i] = vis[j] = 1;
}
return ans;
}
Compilation message (stderr)
# | 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... |