Submission #3595881


Source Code Expand

#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define inf 100000000000007
#define N 1000005
using namespace std;
typedef long long ll;

ll n, x, y, top, bas = 0, son = inf, a[N];

bool dene(ll kac){
	ll kal = kac;
	// a * x + kac * y- a * y > a[i];
	for(int i = 1; i <= n; i++){
		ll bul = ( a[i] - kac * y ) / (x - y ) + (( a[i] - kac * y ) % (x - y ) != 0);
		if(bul > kal)
			return 0;
		kal -= max(0ll, bul);
		// cout << ( a[i] - kac * y ) / (x - y ) + (( a[i] - kac * y ) % (x - y ) != 0) << " " ;

	}
	return 1;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("amk.txt", "w", stdout);
	scanf("%lld %lld %lld",&n ,&x ,&y);
	for(int i = 1; i <= n; i++){
		scanf("%lld",a + i);
		top += a[i];
	}
	son = top/(y*n) + 5;
	while(bas < son){
		ll orta = (bas+son)/2;
		if(dene(orta))
			son = orta;
		else
			bas = orta + 1;
	}
	printf("%lld\n", bas);
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld",&n ,&x ,&y);
                                    ^
./Main.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",a + i);
                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 8
WA × 5
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 31 ms 1024 KB
b08 AC 30 ms 1024 KB
b09 WA 12 ms 1024 KB
b10 WA 13 ms 1024 KB
b11 WA 13 ms 1024 KB
b12 WA 13 ms 1024 KB
b13 WA 36 ms 1024 KB