# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
542991 | Mohammed_Atalah | Arranging Shoes (IOI19_shoes) | C++17 | 1089 ms | 1232 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;
long long count_swaps(std::vector<int> s) {
int n = s.size();
// map<int, set<int>> mp;
// for (int i = 0; i < n; i++) {
// mp[s[i]].insert(i);
// }
// vector<int> vis(n);
// int e = 0;
// int total = 0;
// for (int i = 0; i < n; i++) {
// cout << total << endl;
// if (vis[i - 1] && i > 0) {
// e--;
// }
// if (vis[i]) {
// continue;
// }
// mp[s[i]].erase(mp[s[i]].begin());
// int idx = *mp[s[i] * -1].begin();
// mp[s[i] * -1].erase(mp[s[i] * -1].begin());
// total += idx - (i + e) - 1;
// if (s[i] > 0) {
// total++;
// }
// e++;
// vis[idx] = 1;
// }
// return total;
n--;
cout << (n * (n + 1)) / 2 << endl;
}
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... |