Submission #677072

#TimeUsernameProblemLanguageResultExecution timeMemory
677072penguin133Arranging Shoes (IOI19_shoes)C++17
45 / 100
79 ms11496 KiB
#include <bits/stdc++.h> //#include "shoes.h" using namespace std; //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif set<int> L, R; long long count_swaps(std::vector<int> s) { int n = (int)s.size(); for(int i=0;i<(int)s.size();i++){ if(s[i] < 0)L.insert(i); else R.insert(i); } long long ans = 0; for(int i=0;i<n;i++){ if(i%2){ ans += max(0, *(R.begin()) - i); R.erase(R.begin()); } else{ ans += max(0, *(L.begin()) - i); L.erase(L.begin()); } } 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...