Submission #397679

#TimeUsernameProblemLanguageResultExecution timeMemory
397679ivan24Arranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms296 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[i]){ for (ll k = j; k > 2*i+1; k--){ swap(s[k],s[k-1]); ans++; } } } if (s[2*i] > 0){ swap(s[2*i],s[2*i+1]); 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...