제출 #480665

#제출 시각아이디문제언어결과실행 시간메모리
480665zsomborArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms204 KiB
#include "shoes.h" using namespace std; long long count_swaps(vector<int> sorszam_meret) { int n = sorszam_meret.size() / 2; vector <int> sorszam_hely(2 * n); vector <int> hely_sorszam(2 * n); vector <int> hely_meret(2 * n); for (int i = 0; i < 2 * n; i++) { sorszam_hely[i] = i; hely_sorszam[i] = i; hely_meret[i] = sorszam_meret[i]; } long long ans = 0; for (int i = 0; i < 2 * n; i += 2) { for (int j = i + 2; j < 2 * n; j++) { if (hely_meret[i - 1] == -hely_meret[i]) break; swap(sorszam_hely[hely_sorszam[i + 1]], sorszam_hely[hely_sorszam[j]]); swap(hely_sorszam[i + 1], hely_sorszam[j]); swap(hely_meret[i + 1], hely_meret[j]); ans++; } if (hely_meret[i] > hely_meret[i + 1]) ans++; } return ans; }
#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...