Precreation contest files

This commit is contained in:
2026-02-11 11:28:23 +07:00
parent 0a8ea477bb
commit cb9f7cab30
134 changed files with 1848 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (auto &i : a)
cin >> i;
int h = a[k - 1];
sort(a.begin(), a.end());
int time = 0;
for (auto H : a) {
if (H <= h)
continue;
time += H - h;
if (time > h) {
cout << "NO\n";
return;
}
h = H;
}
cout << "YES\n";
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}