MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

Arrays/_removeElement.cpp:10–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#define pb push_back
9
10int main()
11{
12 ll t;
13 cin >> t;
14 while (t--)
15 {
16 ll n, k;
17 cin >> n >> k;
18 vector<ll> v;
19 for (int i = 0; i < n; i++)
20 {
21 int e;
22 cin >> e;
23 v.pb(e);
24 }
25 if (n == 1)
26 {
27 cout << "Yes" << endl;
28 }
29 else
30 {
31 sort(v.begin(), v.end());
32 ll maxi = *max_element(v.begin(), v.end());
33 ll mini = *min_element(v.begin(), v.end());
34 if (maxi + mini <= k)
35 {
36 cout << "Yes" << endl;
37 }
38 else
39 {
40 cout << "No" << endl;
41 }
42 }
43 }
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected