제출 #512562

#제출 시각아이디문제언어결과실행 시간메모리
512562terrasphereArranging Shoes (IOI19_shoes)C++17
30 / 100
34 ms3504 KiB
#include "shoes.h" #include <bits/stdc++.h> long long count_swaps(std::vector<int> s) { int n=s.size(); if(n==2) { if(s[0]>0) return 1; return 0; } int p=abs(s[0]); int t=1; for(int i=1;i<n;i++) { if(abs(s[i])!=p) t=0; } int arr[101010]; int idx=0; if(t) { long long answer=0; for(int i=0;i<n;i++) { if(s[i]==p) { arr[idx]=i; idx++; } } for(int i=0;i<idx;i++) answer+=abs(arr[i]-2*i-1); return answer; } return 0; }
#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...