# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
249287 | Dilshod_Imomov | Arranging Shoes (IOI19_shoes) | C++17 | 163 ms | 269712 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 <bits/stdc++.h>
# define ll long long
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX_N = 100007;
ll count_swaps( vector < int > s ) {
speed;
ll n = s.size(), sz = 0;
ll ans = 0;
vector < int > ids, used(n);
vector < queue < int > > vc(4 * MAX_N);
for ( int i = 0; i < n; i++ ) {
s[i] += MAX_N;
vc[s[i]].push( i );
}
// cout << "Done 1" << endl;
for ( int i = 0; i < n; i++ ) {
if ( used[i] ) {
continue;
}
s[i] -= MAX_N;
int l = i, r = vc[-s[i] + MAX_N].front();
// cout << "Done 2 " << l << ' ' << r << endl;
vc[ s[i] + MAX_N ].pop();
int rr = r;
used[r] = 1;
vc[-s[i] + MAX_N].pop();
# | 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... |