Submission #3389

# Submission time Handle Problem Language Result Execution time Memory
3389 2013-08-31T05:17:11 Z jihoon King of penalty (kriii1_K) C++
0 / 1
24 ms 1476 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int prob[100001]={0};
int main(){
    int n;
    long long int cnt=0;
    int ti=0;
    int t;
    int i;
    scanf("%d %d",&t,&n);
    for(i=0;i<n;i++){
        scanf("%d",&prob[i]);
    }
    sort(prob,prob+n);
    for(i=0;i<n;i++){
        if(ti+prob[i]>=t) break;
        ti+=prob[i];
        cnt+=((i+1)*prob[i]);
    }
    cnt+=(t-ti-1)*i;
    printf("%d %lld",i,cnt);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1476 KB Output is correct
2 Correct 0 ms 1476 KB Output is correct
3 Correct 0 ms 1476 KB Output is correct
4 Correct 4 ms 1476 KB Output is correct
5 Correct 0 ms 1476 KB Output is correct
6 Correct 4 ms 1476 KB Output is correct
7 Correct 8 ms 1476 KB Output is correct
8 Correct 8 ms 1476 KB Output is correct
9 Correct 20 ms 1476 KB Output is correct
10 Correct 24 ms 1476 KB Output is correct
11 Incorrect 16 ms 1476 KB Output isn't correct
12 Halted 0 ms 0 KB -