Submission #4074

#TimeUsernameProblemLanguageResultExecution timeMemory
4074aintaKing of penalty (kriii1_K)C++98
1 / 1
24 ms1476 KiB
#include<stdio.h> #include<algorithm> using namespace std; int T,N,i,w[100001]; long long S; int main() { scanf("%d%d",&T,&N); for(i=0;i<N;i++)scanf("%d",&w[i]); sort(w,w+N); T--; for(i=0;i<N;i++){ if(T<w[i])break; S=S+T; T-=w[i]; } printf("%d %lld\n",i,S); }
#Verdict Execution timeMemoryGrader output
Fetching results...