제출 #596146

#제출 시각아이디문제언어결과실행 시간메모리
596146alireza_kavianiArranging Shoes (IOI19_shoes)C++17
50 / 100
1088 ms2640 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define SZ(x) int((x).size()) #define all(x) (x).begin() , (x).end() #define sep ' ' const int MAXN = 2e5 + 10; int n , mark[MAXN]; ll count_swaps(vector<int> s) { n = SZ(s); ll ans = 0; for(int i = 0 ; i < n ; i++){ if(mark[i]) continue; int cnt = 0; mark[i] = 1; for(int j = i + 1 ; j < n ; j++){ if(mark[j] == 0 && s[j] == s[i] * -1){ mark[j] = 1; ans += cnt; break; } cnt += (mark[j] == 0); } 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...