# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
3405 | pichulia | King of penalty (kriii1_K) | C++98 | 24 ms | 1476 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |