# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1033726 | ender | Arranging Shoes (IOI19_shoes) | C++17 | 0 ms | 348 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) {
vector<bool> visited(s.size(), false);
vector<int> ns(s.size()); // new s
int pos = 1;
for(int i = 0; i < s.size(); ++i){
if(visited[i]) continue;
int goal = -s[i];
for(int j = i+1; j < s.size(); ++j){
if(visited[j]) continue;
if(s[j] == goal){
if(s[j] > 0){
ns[j] = pos;
ns[i] = -pos;
} else {
ns[j] = -pos;
ns[i] = pos;
}
visited[i] = true;
visited[j] = true;
pos++;
break;
}
}
}
for(const auto &i : ns) cout << i << " ";
cout << "\n";
return 0;
}
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... |