Submission #341096

#TimeUsernameProblemLanguageResultExecution timeMemory
341096israeladewuyiArranging Shoes (IOI19_shoes)C++17
50 / 100
1092 ms3180 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()/2; ll ans = 0; while(n--){ int x = S[0],ind = 1; while(S[ind] != -x)ind++; if(x < 0)ans += ind -1; else ans += ind; S.erase(S.begin()+ind); S.erase(S.begin()); } return ans; } //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...