Submission #185311

# Submission time Handle Problem Language Result Execution time Memory
185311 2020-01-11T10:37:19 Z mohammad Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
2 ms 504 KB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
 
#include<bits/stdc++.h>
#include "boxes.h"
using namespace std;
 
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;

ll ans = 1e18;

ll delivery(int N, int K, int L, int p[]){
	int n = N , k = K ;
	sort(p , p + n);
	for(int i = 0 ; i < k - 1 ; ++i){
		ll d = 0 ;
		int j ;
		for(j = i ; j + K - 1 < N ; j += K)
			d += min(p[j + k - 1] + min(p[j + k - 1] , L - p[j + k - 1]) , L - p[j] + min(L - p[j] , p[j]));
		if(j != N) d += min(p[N -1] + min(p[N - 1] , L - p[N - 1]) , L - p[j - k + 1] + min(L - p[j - k + 1] , p[j - k + 1]));
		if(i) d+= min(L - p[0] + min(L - p[0] , p[0]) , p[i - 1] + min(p[i - 1] , L - p[i - 1]));
		ans = min(ans , d);
	}
	return ans ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -