Submission #4028731


Source Code Expand

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
long long v[100005];
int n;
long long a, b;
bool can(long long x) {
	long long cnt = 0;
	long long c = a - b;
	for(int i = 0; i < n; i++) {
		int y = v[i] - x * b;
		if(y > 0) cnt += (y + c - 1) / c;
	}
	return cnt <= x;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	long long left = 1, right = 1LL * 1e10;
	while(right - left > 1) {
		long long mid = (left + right) / 2;
		if(can(mid)) right = mid;
		else left = mid;
	}
	cout << right << endl;
	return 0;	
}

Submission Info

Submission Time
Task D - Widespread
User Mayimg
Language C++14 (GCC 5.4.1)
Score 0
Code Size 643 Byte
Status WA
Exec Time 45 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 6
WA × 7
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
b04 WA 1 ms 256 KB
b05 WA 29 ms 1024 KB
b06 WA 45 ms 1024 KB
b07 AC 32 ms 1024 KB
b08 AC 30 ms 1024 KB
b09 WA 17 ms 1024 KB
b10 WA 22 ms 1024 KB
b11 WA 40 ms 1024 KB
b12 WA 41 ms 1024 KB
b13 AC 41 ms 1024 KB