# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3599 | arine | King of penalty (kriii1_K) | C++98 | 24 ms | 1868 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 <cstdio>
#include <algorithm>
using namespace std;
typedef long long int lld;
lld P, N, data[100005];
int main() {
scanf("%lld %lld", &P, &N);
for(int i=0; i<N; ++i) scanf("%lld", &data[i]);
sort(data, data+N);
int T=P-1;
lld ans=0, pan=0;
for(int i=0; i<N; ++i) {
if(T-data[i]<0) break;
++ans;
T-=data[i];
pan+=data[i]+T;
}
printf("%lld %lld", ans, pan);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |