제출 #987895

#제출 시각아이디문제언어결과실행 시간메모리
987895mannshah1211Arranging Shoes (IOI19_shoes)C++17
50 / 100
1034 ms3412 KiB
/** * author: tourist * created: **/ #include "shoes.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif long long count_swaps(vector<int> a) { int n = a.size() / 2; long long swaps = 0; for (int i = 0; i < 2 * n; i += 2) { int index = -1; for (int j = i + 1; j < 2 * n; j++) { if (a[i] + a[j] == 0) { index = j; break; } } while (a[i] > 0 || a[i] + a[i + 1] != 0) { swap(a[index], a[index - 1]); swaps++; index--; } } return swaps; }
#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...