57422023-09-13 18:47:154bs0lute0Loud Snackscpp17Runtime error 79/10048ms12148 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main(){
    int N; //The snanks
    int X; //Maximum loud level
    cin >> N >> X;
    vector<int> L(N);
    for (int i = 0; i < N; i++){
        cin >> L.at(i);
    }
    sort(L.begin(), L.end());
    int m = 1;
    int c = 1;
    while (c != N){
        if ((L[c-1] + L[c]) <= X){
            c += 2;
        }else if ((L[c - 1] + L[c]) > X){
            c++;
        }
        m++;
    }
    cout << m;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted3ms1852 KiB
subtask218/18
3Accepted3ms2076 KiB
4Accepted3ms2284 KiB
5Accepted3ms2536 KiB
6Accepted2ms2752 KiB
7Accepted2ms2996 KiB
8Accepted2ms3084 KiB
9Accepted2ms3192 KiB
10Accepted3ms3368 KiB
11Accepted2ms3488 KiB
subtask30/21
12Runtime error8ms3748 KiB
13Runtime error9ms4372 KiB
14Runtime error13ms4584 KiB
15Runtime error14ms4980 KiB
16Runtime error17ms5348 KiB
17Runtime error19ms5672 KiB
18Runtime error21ms5844 KiB
19Runtime error25ms6304 KiB
20Runtime error27ms6772 KiB
subtask436/36
21Accepted3ms5816 KiB
22Accepted3ms5944 KiB
23Accepted3ms5832 KiB
24Accepted3ms5852 KiB
25Accepted3ms6004 KiB
26Accepted3ms6088 KiB
27Accepted3ms6332 KiB
28Accepted3ms6452 KiB
subtask525/25
29Accepted35ms7244 KiB
30Accepted39ms7756 KiB
31Accepted43ms8876 KiB
32Accepted48ms9408 KiB
33Accepted48ms10160 KiB
34Accepted48ms10792 KiB
35Accepted48ms11420 KiB
36Accepted48ms12148 KiB