제출 #147274

#제출 시각아이디문제언어결과실행 시간메모리
147274joylintpArranging Shoes (IOI19_shoes)C++14
10 / 100
1085 ms3192 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int> s) { int n = s.size(), ret = 0; for (int i = 0; i < n; i++) { if (i % 2 == 0) { int j; for (j = i; s[j] > 0; j++); ret += j - i; int t = s[j]; for (int k = j - 1; k >= i; k--) s[k + 1] = s[k]; s[i] = t; } else { int j; for (j = i; s[j] != -s[i - 1]; j++); ret += j - i; int t = s[j]; for (int k = j - 1; k >= i; k--) s[k + 1] = s[k]; s[i] = t; } } return ret; }
#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...