Submission #3596635


Source Code Expand

#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
lo int n,a,b,A[li],sum,A2[li];
bool check(lo int gg){
	lo int tot=gg*b;
	lo int cev=0;
	for(int i=1;i<=n;i++){
		A2[i]=A[i]-tot;
	}
	for(int i=1;i<=n;i++){
		if(A2[i]>0){
			cev+=(A2[i]+(a-b)-1)/(a-b);
		}
	}
	return gg>=cev;
}
int main(){
	scanf("%lld %lld %lld",&n,&a,&b);
	for(int i=1;i<=n;i++) scanf("%lld",&A[i]);
	lo int bas=0,son=1000000000000000/a;
	while(bas<=son){
		lo int mid=(bas+son)/2;
		if(check(mid)) son=mid-1;
		else bas=mid+1;
	}
	printf("%lld\n",bas);
	return 0;
}

Submission Info

Submission Time
Task D - Widespread
User Faruk372742
Language C++14 (GCC 5.4.1)
Score 400
Code Size 730 Byte
Status AC
Exec Time 42 ms
Memory 1792 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:26:34: 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:27:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%lld",&A[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 18 ms 1792 KB
b06 AC 42 ms 1792 KB
b07 AC 25 ms 1792 KB
b08 AC 25 ms 1792 KB
b09 AC 20 ms 1792 KB
b10 AC 19 ms 1792 KB
b11 AC 20 ms 1792 KB
b12 AC 20 ms 1792 KB
b13 AC 38 ms 1792 KB