# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3480 | cki86201 | 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>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
using namespace std;
int p[100010],n,k;
int main()
{
scanf("%d%d",&k,&n);
int i;
for(i=0;i<n;i++)scanf("%d",p+i);
sort(p,p+n);
long long s=0;
for(i=0;i<n;i++){
if(s>=k)break;
s+=p[i];
if(s>=k)break;
}
printf("%d ",i);
long long ans=0,t=0;
for(int j=0;j<i;j++){
ans+=(k-1-t);
t+=p[j];
}
printf("%lld",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |