# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253513 | Badrangiikh | Arranging Shoes (IOI19_shoes) | C++14 | 1087 ms | 1912 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>
#include <deque>
#include <cmath>
using namespace std;
#define ll long long
/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/
long long count_swaps ( vector < int > s ) {
int n = s . size ( ) ;
long long x = 0 ;
while ( s . size ( ) > 0 ) {
int n = s . size ( ) ;
for ( int i = 0 ; i < n ; i ++ ) {
if ( s [ i ] < 0 ) {
for ( int j = 0 ; j < n ; j ++ ) {
if ( s [ j ] == s [ i ] * ( -1 ) ) {
if ( j > i ) {
x += ( i + j - 1 ) ;
s . erase ( s . begin ( ) + j ) ;
s . erase ( s . begin ( ) + i ) ;
}
else {
x += ( i + j ) ;
s . erase ( s . begin ( ) + i ) ;
s . erase ( s . begin ( ) + j ) ;
}
break ;
}
}
break ;
}
}
}
return x ;
}
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... |