# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143987 | Nucleist | Arranging Shoes (IOI19_shoes) | C++14 | 1059 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 "shoes.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
ll count_swaps(vector<int>S)
{
//flash;
ll ans=0;
ll index=0;
int n=S.size()/2;
for (int i = 0; i < 2*n; i+=2)
{
for (int j = i+1; j < 2*n; ++j)
{
if(S[j]==(-S[i]))
{
int nexi=j;
while(S[i+1]!=(-S[i]))
{
int k = S[nexi-1];
S[nexi-1]=S[nexi];
S[nexi]=k;
nexi--;
ans++;
}
break;
}
}
if(S[i]>0)
{
int yo=S[i];
S[i]=S[i+1];
S[i+1]=yo;
ans++;
}
}
return ans;
}
//code the AC sol !
// BS/queue/map
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... |