# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253475 | Badrangiikh | Arranging Shoes (IOI19_shoes) | C++14 | 33 ms | 2040 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);*/
int count_swaps ( vector < int > s ) {
int n = s . size ( ) ;
if ( n == 2 ) {
if ( s [ 0 ] < s [ 1 ] ) return 0 ;
else return 1 ;
}
int x = 0 ;
for ( int i = 1 ; i < n ; i ++ ) {
if ( abs ( s [ i ] ) == abs ( s [ 0 ] ) ) x ++ ;
}
if ( x + 1 == n ) {
int y = 0 ;
int z = 0 ;
for ( int i = 0 ; i < n ; i ++ ) {
if ( s [ i ] < 0 ) {
z += abs ( i - y ) ;
y += 2 ;
}
}
return z ;
}
}
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... |