제출 #222862

#제출 시각아이디문제언어결과실행 시간메모리
222862MrDominoArranging Shoes (IOI19_shoes)C++14
25 / 100
45 ms4504 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; typedef long long ll; ll get_dist(vector<int> ord) { ll sol = 0; for (int i = 0; i < (int) ord.size(); i++) { sol += abs(ord[i] - i); } return sol / 2; } long long count_swaps(vector<int> a) { int n = (int) a.size() / 2; if (n == 1) { if (a[0] < 0) { return 0; } else { return 1; } } bool sim_sub = 1; for (int i = 0; i < n; i++) { sim_sub &= (a[i] < 0 && a[i + n] > 0 && a[i] == -a[i + n]); } if (sim_sub) { vector<int> ord; for (int i = 0; i < n; i++) { ord.push_back(i); ord.push_back(i + n); } return get_dist(ord); } return 0; }
#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...