제출 #1135265

#제출 시각아이디문제언어결과실행 시간메모리
1135265vibeduckArranging Shoes (IOI19_shoes)C++20
50 / 100
1096 ms2632 KiB
#include "shoes.h" //#define int long long long long count_swaps(std::vector<int> s) { int n = (int)s.size(); std::vector<int> in(n, 1); long long ans = 0; for (int i = 0; i < n; i++) { if (!in[i]) continue; int bw = 0; int x = -1; for (int j = i + 1; j < n; j++) { if (!in[j]) continue; if (s[j] == -s[i]) { x = j; break; } bw++; } ans += (long long)bw + (long long)((bool)(s[i] > s[x])); in[x] = 0; } 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...