제출 #1077769

#제출 시각아이디문제언어결과실행 시간메모리
1077769BoasArranging Shoes (IOI19_shoes)C++17
50 / 100
1095 ms3416 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; #define int long long #define sz(x) (int)x.size() #define pb push_back #define loop(x, i) for (int i = 0; i < x; i++) #define rev(x, i) for (int i = (int)x - 1; i >= 0; i--) #define ALL(x) begin(x), end(x) typedef signed i32; typedef vector<i32> vi32; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<vi> vvi; typedef vector<vb> vvb; int count_swaps(vi32 s) { int n = sz(s); int res = 0; for (int i = 0; i < n; i += 2) { for (int j = i + 1; j < n; j++) { if (s[j] == -s[i]) { for (int k = j; k > i + 1; k--) { swap(s[k], s[k - 1]); res++; } assert(s[i] == -s[i + 1]); if (s[i] > 0) { swap(s[i], s[i + 1]); res++; } break; } } } 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...