답안 #3616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3616 2013-08-31T07:00:30 Z jihoon King of penalty (kriii1_K) C++
1 / 1
24 ms 1476 KB
#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;
}
# 결과 실행 시간 메모리 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 4 ms 1476 KB Output is correct
9 Correct 24 ms 1476 KB Output is correct
10 Correct 20 ms 1476 KB Output is correct
11 Correct 12 ms 1476 KB Output is correct
12 Correct 12 ms 1476 KB Output is correct
13 Correct 0 ms 1476 KB Output is correct
14 Correct 0 ms 1476 KB Output is correct
15 Correct 4 ms 1476 KB Output is correct