Submission #1466379


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <unordered_map>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define D(x) cout << #x << " = " << x << endl
#define DD(x,y) cout << #x << " = " << x << " " << #y << " = " << y << endl
#define Max 300005
#define PI 3.141592653589793
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define mod 1000000007
#define INF (LL)1e18

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos)
{
    return n=n | (1 << pos);
}
int resb(int n,int pos)
{
    return n=n & ~(1 << pos);
}
bool checkb(int n,int pos)
{
    return (bool)(n & (1 << pos));
}

LL ara[100],n;

LL F()
{
	LL ret = 0;
	while(1)
	{
		sort(ara+1,ara+n+1);
		if(ara[n] < n)break;
		LL need = ara[n] - (n-1);
		LL item = need / n;
		if(need % n)item++;
		ara[n] -= (n * item);
		for(LL i = 1; i < n; i++)ara[i] += item;
		ret += item;
	}
	return ret;
}

int main()
{
	//FI;
	LL i;
	sl(n);
	rep(i,n)sl(ara[i]);
	LL ret = F();
	pl(ret); NL;
	return 0;
}

Submission Info

Submission Time
Task E - Decrease (Judge ver.)
User Z0RR0
Language C++14 (GCC 5.4.1)
Score 600
Code Size 2012 Byte
Status AC
Exec Time 31 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:89:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  sl(n);
       ^
./Main.cpp:90:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  rep(i,n)sl(ara[i]);
                    ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 5
AC × 35
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 AC 31 ms 256 KB
maxrand2 AC 1 ms 256 KB
maxrand3 AC 27 ms 256 KB
maxrand4 AC 1 ms 256 KB
maxrand5 AC 27 ms 256 KB
maxrand6 AC 1 ms 256 KB
maxrand7 AC 24 ms 256 KB
maxrand8 AC 1 ms 256 KB
maxrand9 AC 19 ms 256 KB
rand0 AC 1 ms 256 KB
rand1 AC 2 ms 256 KB
rand2 AC 3 ms 256 KB
rand3 AC 5 ms 256 KB
rand4 AC 2 ms 256 KB
rand5 AC 2 ms 256 KB
rand6 AC 1 ms 256 KB
rand7 AC 11 ms 256 KB
rand8 AC 1 ms 256 KB
rand9 AC 2 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 1 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