제출 #597548

#제출 시각아이디문제언어결과실행 시간메모리
597548FatihSolakArranging Shoes (IOI19_shoes)C++17
15 / 100
24 ms3128 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s){ long long ans = 0; int n = s.size(); long long x = n/2; return (x-1) * (x) / 2; for(int i = 0;i<n;i+=2){ for(int j = i;j<n;j++){ if(s[j] < 0){ for(int c = j-1;c>=i;c--){ swap(s[c],s[c+1]); ans++; } break; } } for(int j = i+1;j<n;j++){ if(s[j] == -s[i]){ for(int c = j-1;c>=i+1;c--){ swap(s[c],s[c+1]); ans++; } break; } } } 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...