제출 #921410

#제출 시각아이디문제언어결과실행 시간메모리
921410AverageAmogusEnjoyerArranging Shoes (IOI19_shoes)C++17
50 / 100
1069 ms3260 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; } template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; } const int nax = 100100; ll count_swaps(vector<int> a) { ll ans = 0; int n = (int)a.size(); for (int i=0;i<n;i+=2) { for (int j=i;j<n;j++) { if (a[j] == -a[i]) { for (int k=j-1;k>i;k--) { swap(a[k],a[k+1]); ans++; } break; } } if (a[i] > 0) { swap(a[i],a[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...