Submission #3616

#TimeUsernameProblemLanguageResultExecution timeMemory
3616jihoonKing of penalty (kriii1_K)C++98
1 / 1
24 ms1476 KiB
#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 timeMemoryGrader output
Fetching results...