제출 #426706

#제출 시각아이디문제언어결과실행 시간메모리
426706dreezyArranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms204 KiB
#include "shoes.h"
#include <bits/stdc++.h>

using namespace std;
#define ll long long

//n = 1 its either 1 or 0
//n = 8 we can brutazo
//all shoes are same, we just need to get all inversion (even is left, odd is right)
//all shoes need to travel n?

//eta ~ 25 minutes

/*full solutions*/
//O(N^2) 
/*
dp[n][i]
//min swaps at position i after considering n pairs? 

*/

/*SUBTASK 1-2*/

long long count_swaps(vector<int> s) {
	
	ll ans = 0;
	int n = s.size();
	int first = 0;
	for(int i =0; i<n; i++){
		if(s[i] < 0){
			ans += abs(s[i] - first);
			first +=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...