-
Notifications
You must be signed in to change notification settings - Fork 0
/
B. Orac and Medians.cpp
46 lines (44 loc) · 1.05 KB
/
B. Orac and Medians.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <fstream>
#include <string>
#include <iostream>
#include <math.h>
#include <bitset>
#include <algorithm>
#include<bits/stdc++.h>
#include <vector>
using namespace std;
int t;
long long n, k;
long long arr[100001];
int main(){
cin >> t;
for (int z = 0; z < t; z++){
cin >> n >> k;
for (int x = 0; x < n; x++){
cin >> arr[x];
}
bool worksone = false;
for (int x = 0; x < n; x++){
if (arr[x] == k){
worksone = true;
}
}
bool workstwo = false;
for (int x = 0; x < n; x++){
if (arr[x] >= k){
if (x < n - 1 && arr[x + 1] >= k){
workstwo = true;
}
if (x < n - 2 && arr[x + 2] >= k){
workstwo = true;
}
}
}
if ((worksone && workstwo) || (n == 1 && worksone)){
cout << "yes\n";
}
else{
cout << "no\n";
}
}
}