제출 #713439

#제출 시각아이디문제언어결과실행 시간메모리
713439europiumArranging Shoes (IOI19_shoes)C++17
45 / 100
26 ms3156 KiB
#include "shoes.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;

using ll = long long;

// subtask 4 - 15 points
// ll count_swaps(vector<int> s) {
// 	ll n = s.size() / 2;
// 	return n * (n - 1) / 2;
// }

// subtask 3
ll count_swaps(vector<int> a) {
	ll n = a.size();
	ll closest = 0;
	ll ans = 0;

	for (ll i = 0; i < n; i++){
		if (a[i] < 0){
			ans += abs(i - closest);
			closest +=2 ;
		}
	}

	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...