Submission #1882227


Source Code Expand

#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;

int n; ll A[55],sum;
inline bool check(ll x)
{
	if(x<0) return 0;
	ll al=0;
	for(int i=1;i<=n;i++)
		al+=(ll)ceil(1.0*(A[i]+x-n)/(n+1))+bool((A[i]+x-n)%(n+1)==0);
	return al<=x;
}
signed main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&A[i]);
	for(int i=1;i<=n;i++) sum+=A[i];
	for(int i=n*n-n;i>=0;i--)
	{
		if(check(sum-1ll*i))
		{
			printf("%lld\n",sum-1ll*i);
			return 0;
		}
	}
	assert(0);
	return 0;
}

Submission Info

Submission Time
Task E - Decrease (Judge ver.)
User wcz111
Language C++14 (GCC 5.4.1)
Score 0
Code Size 550 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
./Main.cpp:19: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 / 600
Status
AC × 5
AC × 16
WA × 19
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, maxrand3, maxrand4, maxrand5, maxrand6, maxrand7, maxrand8, maxrand9, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9, small0, small1, small2, small3, small4, small5, small6, small7, small8, small9
Case Name Status Exec Time Memory
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
example3 AC 1 ms 256 KB
example4 AC 1 ms 256 KB
maxrand0 AC 1 ms 256 KB
maxrand1 WA 1 ms 256 KB
maxrand2 WA 1 ms 256 KB
maxrand3 WA 1 ms 256 KB
maxrand4 WA 1 ms 256 KB
maxrand5 WA 1 ms 256 KB
maxrand6 WA 1 ms 256 KB
maxrand7 WA 1 ms 256 KB
maxrand8 WA 1 ms 256 KB
maxrand9 WA 1 ms 256 KB
rand0 WA 1 ms 256 KB
rand1 WA 1 ms 256 KB
rand2 WA 1 ms 256 KB
rand3 WA 1 ms 256 KB
rand4 WA 1 ms 256 KB
rand5 WA 1 ms 256 KB
rand6 WA 1 ms 256 KB
rand7 WA 1 ms 256 KB
rand8 WA 1 ms 256 KB
rand9 WA 1 ms 256 KB
small0 AC 1 ms 256 KB
small1 AC 1 ms 256 KB
small2 AC 1 ms 256 KB
small3 AC 1 ms 256 KB
small4 AC 2 ms 256 KB
small5 AC 2 ms 256 KB
small6 AC 1 ms 256 KB
small7 AC 1 ms 256 KB
small8 AC 2 ms 256 KB
small9 AC 2 ms 256 KB