Submission #1864645
Source Code Expand
#include <cstdio>
typedef long long ll;
ll n, a, b, l=1, r=1e18, m, ans, h[100005];
bool f(ll p) {
ll i, c=0;
for(i=0; i<n; i++)
c += h[i]>p*b ? (h[i]-p*b+a-1)/a : 0;
return c<=p;
}
int main() {
scanf("%lld%lld%lld", &n, &a, &b);
a -= b;
for(ll i=0; i<n; i++) scanf("%lld", &h[i]);
while(l<r) {
m = (l+r) / 2;
if(f(m)) r = m;
else l = m+1;
}
printf("%lld", r);
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Widespread |
User |
t1234 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
416 Byte |
Status |
WA |
Exec Time |
75 ms |
Memory |
896 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:13:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld%lld", &n, &a, &b);
^
./Main.cpp:15:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(ll i=0; i<n; i++) scanf("%lld", &h[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 400 |
Status |
|
|
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 |
128 KB |
a02 |
AC |
1 ms |
128 KB |
a03 |
AC |
1 ms |
128 KB |
b04 |
AC |
1 ms |
128 KB |
b05 |
WA |
59 ms |
896 KB |
b06 |
AC |
36 ms |
896 KB |
b07 |
AC |
30 ms |
896 KB |
b08 |
AC |
28 ms |
896 KB |
b09 |
AC |
16 ms |
896 KB |
b10 |
WA |
75 ms |
896 KB |
b11 |
AC |
20 ms |
896 KB |
b12 |
WA |
66 ms |
896 KB |
b13 |
AC |
40 ms |
896 KB |