Submission #1030733

#TimeUsernameProblemLanguageResultExecution timeMemory
1030733fv3Arranging Shoes (IOI19_shoes)C++14
45 / 100
31 ms2808 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll count_swaps(vector<int> s) { const ll N = s.size() / 2; vector<int> l(N), r(N); int lc = 0; int rc = 0; for (int i = 0; i < 2*N; i++) { if (s[i] < 0) l[lc++] = i; else r[rc++] = i; } ll res = 0; int pos = 0; for (int i = 0; i < N; i++) { if (l[i] > pos) res += l[i] - pos; pos += 2; } pos = 1; for (int i = 0; i < N; i++) { if (r[i] > pos) res += r[i] - pos; pos += 2; } return res; }
#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...