# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3405 | pichulia | 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<stdlib.h>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace::std;
int a[100008];
int n, m;
void input()
{
scanf("%d %d",&m,&n);
for(int i=0; i<n; i++)
scanf("%d",&a[i]);
sort(a,a+n);
}
void process()
{
int i, j;
j=0;
long long int k=0, l=0;
for(i=0; i<n; i++)
{
j+=a[i];
if(j>=m)
{
break;
}
}
printf("%d ",i);
for(j=0; j<i;j++)
{
k += (m-1-l);
l += a[j];
}
printf("%lld",k);
}
void output()
{
}
int main()
{
input();
process();
output();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |