# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
4074 | ainta | King of penalty (kriii1_K) | C++98 | 24 ms | 1476 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |