# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3616 | jihoon | 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 prob[100001]={0};
int main(){
int n;
int ct=0;
long long int cnt=0;
int ti;
int t;
int i;
scanf("%d %d",&t,&n);
for(i=0;i<n;i++){
scanf("%d",&prob[i]);
}
sort(prob,prob+n);
ti=t-1;
for(i=0;i<n;i++){
if(ti<prob[i]) break;
ct++;
cnt+=ti;
ti-=prob[i];
}
printf("%d %lld",ct,cnt);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |