Submission #942479
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;
int k,t;
int a[125];
int main(){
scanf("%d%d",&k,&t);
REP(i,t)scanf("%d",a+i);
int mx = *max_element(a,a+t);
printf("%d\n",max(0,mx-(k-mx+1)));
return 0;
}
Submission Info
Submission Time
2016-10-23 21:04:21+0900
Task
B - K Cakes
User
rickytheta
Language
C++14 (GCC 5.4.1)
Score
200
Code Size
1046 Byte
Status
AC
Exec Time
3 ms
Memory
384 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:38:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&k,&t);
^
./Main.cpp:39:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i,t)scanf("%d",a+i);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
200 / 200
Status
Set Name
Test Cases
Sample
0_000.txt, 0_001.txt, 0_002.txt
All
0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt
Case Name
Status
Exec Time
Memory
0_000.txt
AC
2 ms
256 KB
0_001.txt
AC
3 ms
256 KB
0_002.txt
AC
3 ms
256 KB
1_003.txt
AC
2 ms
256 KB
1_004.txt
AC
3 ms
256 KB
1_005.txt
AC
3 ms
384 KB
1_006.txt
AC
2 ms
256 KB
1_007.txt
AC
3 ms
256 KB
1_008.txt
AC
2 ms
256 KB
1_009.txt
AC
2 ms
256 KB