Submission #3595915
Source Code Expand
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define orta ((bas+son)/2)
#define N 1000005
using namespace std;
typedef long long ll;
ll n, A, B, bas, son, h[N];
bool dene(ll x){
ll kal = x;
for(int i = 1; i <= n; i++){
ll bul;
if(x >= h[i]/B)
bul = 0;
bul = (h[i] - x*B)/(A - B) + ((h[i] - x*B)%(A - B) != 0);
if(bul > kal)
return 0;
kal -= bul;
}
return 1;
}
int main() {
// freopen("in.txt", "r", stdin);
// freopen("amk.txt", "w", stdout);
scanf("%lld %lld %lld",&n ,&A ,&B);
for(int i = 1; i <= n; i++){
scanf("%lld",h + i);
son = max(son, h[i]/B + 2);
}
while(bas < son)
if(dene(orta))
son = orta;
else
bas = orta + 1;
printf("%lld\n", orta);
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Widespread |
User |
ekrem |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
804 Byte |
Status |
WA |
Exec Time |
38 ms |
Memory |
1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:31:36: 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:33:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
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 |
256 KB |
a02 |
AC |
1 ms |
256 KB |
a03 |
AC |
1 ms |
256 KB |
b04 |
AC |
1 ms |
256 KB |
b05 |
AC |
15 ms |
1024 KB |
b06 |
AC |
30 ms |
1024 KB |
b07 |
AC |
30 ms |
1024 KB |
b08 |
AC |
31 ms |
1024 KB |
b09 |
WA |
31 ms |
1024 KB |
b10 |
WA |
32 ms |
1024 KB |
b11 |
WA |
30 ms |
1024 KB |
b12 |
WA |
21 ms |
1024 KB |
b13 |
WA |
38 ms |
1024 KB |