Submission #3596056


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 bas = 0, son = kal + 1;
		while(bas < son)
			if(orta*A + (x - orta)*B >= h[i])
				son = orta;
			else
				bas = orta + 1;
		if(orta > kal)
			return 0;
		kal -= orta;
	}
	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 400
Code Size 839 Byte
Status AC
Exec Time 170 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33: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:35: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 400 / 400
Status
AC × 3
AC × 13
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 147 ms 1024 KB
b07 AC 76 ms 1024 KB
b08 AC 79 ms 1024 KB
b09 AC 170 ms 1024 KB
b10 AC 95 ms 1024 KB
b11 AC 121 ms 1024 KB
b12 AC 89 ms 1024 KB
b13 AC 139 ms 1024 KB