제출 #143195

#제출 시각아이디문제언어결과실행 시간메모리
143195NavickArranging Shoes (IOI19_shoes)C++17
50 / 100
1072 ms2040 KiB
#include "shoes.h" long long count_swaps(std::vector<int> s) { int n = s.size() / 2; long long answer = 0; for (int i=0; i<2*n; i+=2) { for (int j=i+1; j<2*n; j++) if(s[j] == -s[i]) { answer += j - i - 1; for (int k=j-1; k>=i+1; k--) s[k + 1] = s[k]; break ; } if(s[i] > 0) answer ++; } return answer; }
#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...