제출 #436491

#제출 시각아이디문제언어결과실행 시간메모리
436491rGamerArranging Shoes (IOI19_shoes)C++17
10 / 100
1096 ms3268 KiB
#include <bits/stdc++.h> #define ll long long #define vi vector<int> using namespace std; ll count_swaps(vi s) { int n = s.size(), ans = 0; for(int i = 0; i < n; ++i) { if(i % 2) { int j = i; while(s[j] != -s[i - 1]) j++; while(j != i) { swap(s[j], s[j - 1]); ans++; j--; } } else if(s[i] > 0) { int j = i + 1; while(s[j] > 0) j++; while(j != i) { swap(s[j], s[j - 1]); ans++; j--; } } } 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...