# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199098 | reda | Arranging Shoes (IOI19_shoes) | C++14 | 1092 ms | 2172 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
#pragma GCC optimize ("Ofast","unroll-loops")
using namespace std;
#define all(x) x.begin(),x.end()
#define pb push_back
const ll MAXN = 1e5 + 4 ;
long long count_swaps (vector<int>s)
{
ll n = s.size();
bool c=1;
long long ans = 0 ;
n=n/2LL;
for(int i = 0 ;i<n;i++)
{
if(s[i]!=-1*s[i+n] || s[i]>0){c=0;break;}
}
if(c){
return (ll)n*(n-1)/2LL;
}
for(int i = 0 ;i < s.size();i+=2)
{
int j = i+1;
while(s[i]!=-s[j])
{
j++;
}
while (j!=i+1)
{
swap(s[j],s[j-1]);
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... |