제출 #397751

#제출 시각아이디문제언어결과실행 시간메모리
397751ivan24Arranging Shoes (IOI19_shoes)C++14
50 / 100
1092 ms1948 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; using ll = long long 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++){ for (ll j = 2*i+1; 2*n > j; j++){ if (s[j] == -s[2*i]){ for (ll k = j; k > 2*i+1; k--){ swap(s[k],s[k-1]); //cout << k << ' ' << k-1 << endl; ans++; } break; } } if (s[2*i] > 0){ swap(s[2*i],s[2*i+1]); //cout << 2*i << ' ' << 2*i+1 << endl; ans++; } } 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...