5742 | 2023-09-13 18:47:15 | 4bs0lute0 | Loud Snacks | cpp17 | Runtime error 79/100 | 48ms | 12148 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 1852 KiB | ||||
subtask2 | 18/18 | ||||||
3 | Accepted | 3ms | 2076 KiB | ||||
4 | Accepted | 3ms | 2284 KiB | ||||
5 | Accepted | 3ms | 2536 KiB | ||||
6 | Accepted | 2ms | 2752 KiB | ||||
7 | Accepted | 2ms | 2996 KiB | ||||
8 | Accepted | 2ms | 3084 KiB | ||||
9 | Accepted | 2ms | 3192 KiB | ||||
10 | Accepted | 3ms | 3368 KiB | ||||
11 | Accepted | 2ms | 3488 KiB | ||||
subtask3 | 0/21 | ||||||
12 | Runtime error | 8ms | 3748 KiB | ||||
13 | Runtime error | 9ms | 4372 KiB | ||||
14 | Runtime error | 13ms | 4584 KiB | ||||
15 | Runtime error | 14ms | 4980 KiB | ||||
16 | Runtime error | 17ms | 5348 KiB | ||||
17 | Runtime error | 19ms | 5672 KiB | ||||
18 | Runtime error | 21ms | 5844 KiB | ||||
19 | Runtime error | 25ms | 6304 KiB | ||||
20 | Runtime error | 27ms | 6772 KiB | ||||
subtask4 | 36/36 | ||||||
21 | Accepted | 3ms | 5816 KiB | ||||
22 | Accepted | 3ms | 5944 KiB | ||||
23 | Accepted | 3ms | 5832 KiB | ||||
24 | Accepted | 3ms | 5852 KiB | ||||
25 | Accepted | 3ms | 6004 KiB | ||||
26 | Accepted | 3ms | 6088 KiB | ||||
27 | Accepted | 3ms | 6332 KiB | ||||
28 | Accepted | 3ms | 6452 KiB | ||||
subtask5 | 25/25 | ||||||
29 | Accepted | 35ms | 7244 KiB | ||||
30 | Accepted | 39ms | 7756 KiB | ||||
31 | Accepted | 43ms | 8876 KiB | ||||
32 | Accepted | 48ms | 9408 KiB | ||||
33 | Accepted | 48ms | 10160 KiB | ||||
34 | Accepted | 48ms | 10792 KiB | ||||
35 | Accepted | 48ms | 11420 KiB | ||||
36 | Accepted | 48ms | 12148 KiB |