Submission #340623

#TimeUsernameProblemLanguageResultExecution timeMemory
340623israeladewuyiArranging Shoes (IOI19_shoes)C++17
50 / 100
1089 ms2028 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; #define PB push_back #define pb pop_back #define in insert #define endl "\n" const unsigned int M = 1000000007; ll count_swaps(vi S){ ll n = S.size(); ll swaps = 0; for(ll i= 0; i < n; i+=2){ ll ind = -1; for(ll j = i + 1; j < n; j++){ if(S[j] == - S[i]){ ind = j; break; } } for(ll j = ind; j > i + 1; j--){ swap(S[j], S[j-1]); swaps++; } if(S[i+1] < S[i]){ swap(S[i], S[i+1]); swaps++; } } return swaps; } //int main(){ // vi v; // v.PB(-2); // v.PB(2); // v.PB(2); // v.PB(-2); // cout<<count_swaps(v); //}
#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...