Precreation contest files
This commit is contained in:
BIN
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/cpp.out
Executable file
BIN
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/cpp.out
Executable file
Binary file not shown.
11
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/input1
Normal file
11
Codeforces/GoodBye20242025isNEAR/ATenderCarpenter/input1
Normal 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
|
||||
@@ -0,0 +1,5 @@
|
||||
YES
|
||||
NO
|
||||
NO
|
||||
YES
|
||||
YES
|
||||
@@ -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();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user