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

Binary file not shown.

View File

@@ -0,0 +1,11 @@
5
4
2 3 5 7
4
115 9 2 28
5
8 4 1 6 2
6
1 5 4 1 4 7
2
100000 100000

View File

@@ -0,0 +1,5 @@
YES
NO
NO
YES
YES

View File

@@ -0,0 +1,55 @@
#include <iostream>
using namespace std;
int a[200];
bool check(int a, int b, int c) {
if (a + b <= c)
return false;
if (a + c <= b)
return false;
if (b + c <= a)
return false;
return true;
}
void run() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
if (n == 2) {
if (check(a[0], a[0], a[1]) || check(a[0], a[1], a[1])) {
cout << "YES\n";
} else {
cout << "NO\n";
}
return;
}
for (int i = 0; i < n - 2; i++) {
if (check(a[i], a[i + 1], a[i + 2])) {
cout << "YES\n";
return;
}
}
for (int i = 0; i < n - 1; i++) {
if (check(a[i], a[i], a[i + 1]) || check(a[i], a[i + 1], a[i + 1])) {
cout << "YES\n";
return;
}
}
cout << "NO\n";
}
int main() {
int t;
cin >> t;
while (t--) {
run();
};
}