Submission #4074

# Submission time Handle Problem Language Result Execution time Memory
4074 2013-08-31T18:59:16 Z ainta King of penalty (kriii1_K) C++
1 / 1
24 ms 1476 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int T,N,i,w[100001];
long long S;
int main()
{
	scanf("%d%d",&T,&N);
	for(i=0;i<N;i++)scanf("%d",&w[i]);
	sort(w,w+N);
	T--;
	for(i=0;i<N;i++){
		if(T<w[i])break;
		S=S+T;
		T-=w[i];
	}
	printf("%d %lld\n",i,S);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1476 KB Output is correct
2 Correct 0 ms 1476 KB Output is correct
3 Correct 0 ms 1476 KB Output is correct
4 Correct 4 ms 1476 KB Output is correct
5 Correct 0 ms 1476 KB Output is correct
6 Correct 4 ms 1476 KB Output is correct
7 Correct 8 ms 1476 KB Output is correct
8 Correct 8 ms 1476 KB Output is correct
9 Correct 24 ms 1476 KB Output is correct
10 Correct 20 ms 1476 KB Output is correct
11 Correct 16 ms 1476 KB Output is correct
12 Correct 8 ms 1476 KB Output is correct
13 Correct 0 ms 1476 KB Output is correct
14 Correct 0 ms 1476 KB Output is correct
15 Correct 12 ms 1476 KB Output is correct