제출 #397654

#제출 시각아이디문제언어결과실행 시간메모리
397654ivan24Arranging Shoes (IOI19_shoes)C++14
10 / 100
1098 ms3128 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; using ll = int; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<ll,ll> ii; typedef vector<ii> vii; typedef vector<vii> vvii; #define F first #define S second long long count_swaps(vector<int> s) { ll n; n = s.size(); n /= 2; ll ans = 0; for (ll i = 0; n > i; i++){ ll lf; for (ll j = 2*i; 2*n > j; j++){ if (0 > s[j]){ lf = -s[j]; for (ll k = j; k >= 2*i+1; k--){ swap(s[k],s[k-1]); ans++; } break; } } for (ll j = 2*i+1; 2*n > j; j++){ if (s[j] == lf){ for (ll k = j; k >= 2*i+2; k--){ swap(s[k],s[k-1]); ans++; } break; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...