9884 | 2024-03-14 20:26:50 | zhuyi | Loud Snacks | cpp17 | Accepted 100/100 | 52ms | 11580 KiB |
#include<iostream>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x;
int v=0;
cin>>n>>x;
vector <int> l;
for(int i=0;i<n;i++){
int a=0;
cin>>a;
l.push_back(a);
}
sort(l.begin(),l.end());
for(int i=0;i<n;i++){
if(l[i] + l[i+1]<= x){
v++;
i++;
}
else v++;
}
cout<<v;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1808 KiB | ||||
2 | Accepted | 3ms | 1940 KiB | ||||
subtask2 | 18/18 | ||||||
3 | Accepted | 3ms | 2156 KiB | ||||
4 | Accepted | 2ms | 2244 KiB | ||||
5 | Accepted | 3ms | 2436 KiB | ||||
6 | Accepted | 2ms | 2308 KiB | ||||
7 | Accepted | 3ms | 2440 KiB | ||||
8 | Accepted | 2ms | 2456 KiB | ||||
9 | Accepted | 2ms | 2572 KiB | ||||
10 | Accepted | 3ms | 2712 KiB | ||||
11 | Accepted | 2ms | 2668 KiB | ||||
subtask3 | 21/21 | ||||||
12 | Accepted | 8ms | 3096 KiB | ||||
13 | Accepted | 9ms | 3264 KiB | ||||
14 | Accepted | 13ms | 3784 KiB | ||||
15 | Accepted | 14ms | 3992 KiB | ||||
16 | Accepted | 17ms | 4160 KiB | ||||
17 | Accepted | 20ms | 5168 KiB | ||||
18 | Accepted | 23ms | 5400 KiB | ||||
19 | Accepted | 25ms | 5624 KiB | ||||
20 | Accepted | 28ms | 6036 KiB | ||||
subtask4 | 36/36 | ||||||
21 | Accepted | 3ms | 5136 KiB | ||||
22 | Accepted | 3ms | 5148 KiB | ||||
23 | Accepted | 3ms | 5132 KiB | ||||
24 | Accepted | 3ms | 5140 KiB | ||||
25 | Accepted | 3ms | 5408 KiB | ||||
26 | Accepted | 3ms | 5388 KiB | ||||
27 | Accepted | 3ms | 5392 KiB | ||||
28 | Accepted | 3ms | 5508 KiB | ||||
subtask5 | 25/25 | ||||||
29 | Accepted | 35ms | 7024 KiB | ||||
30 | Accepted | 41ms | 7660 KiB | ||||
31 | Accepted | 46ms | 8084 KiB | ||||
32 | Accepted | 50ms | 8840 KiB | ||||
33 | Accepted | 50ms | 9492 KiB | ||||
34 | Accepted | 50ms | 10184 KiB | ||||
35 | Accepted | 50ms | 10888 KiB | ||||
36 | Accepted | 52ms | 11580 KiB |