제출 #677036

#제출 시각아이디문제언어결과실행 시간메모리
677036hello_there_123Arranging Shoes (IOI19_shoes)C++17
50 / 100
1082 ms3256 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int>s) { int ans = 0; int n = s.size(); bool arr[n+3]; memset(arr,0,sizeof(arr)); for(int i=0;i<n;i++){ if(arr[i]) continue; int cnt = 0; for(int j=i+1;j<n;j++){ if(s[j] == -s[i] && arr[j] == 0){ arr[j] = 1; ans+=cnt; break; } else if(arr[j] == 0) cnt++; } if(s[i]>0) 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...