Submission #1129250

#TimeUsernameProblemLanguageResultExecution timeMemory
1129250coolavy999Boxes with souvenirs (IOI15_boxes)C++20
10 / 100
0 ms328 KiB
// Problem: https://oj.uz/problem/view/IOI15_boxes

#include "bits/stdc++.h"
using namespace std;

using ll = long long;

ll delivery(int n, int k, int l, int pos[]) {
	sort(pos, pos + n);

	if (k == 1) { // subtask 1
		ll ans = 0;
		int mid = l >> 1;
		for (int i = 0; i < n; i++) {
			if (pos[i] <= mid) {
				ans += 1ll * 2 * pos[i];
			} else {
				ans += 1ll * 2 * (l - pos[i]);
			}
		}

		return ans;
	} else if (k == n) { // subtask 2
		return l;
	} else { // subtask 3-7
		return 47;
	}
}
#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...