Advertisement
Galebickosikasa

Untitled

May 12th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
  2. #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx")
  3. // #pragma comment(linker, "/stack:200000000"]
  4.  
  5. #include <iostream>
  6. #include <vector>
  7. #include <cmath>
  8. #include <algorithm>
  9. #include <unordered_set>
  10. #include <unordered_map>
  11. #include <set>
  12. #include <map>
  13. #include <queue>
  14. #include <deque>
  15. #include <bitset>
  16. #include <stack>
  17. #include <random>
  18. #include <fstream>
  19. #include <sstream>
  20. #include <chrono>
  21.  
  22. #define fi first
  23. #define se second
  24. #define pb push_back
  25. #define ll long long
  26. #define ld long double
  27. #define hm unordered_map
  28. #define pii pair<int, int>
  29. #define sz(a) (int)a.size()
  30. #define all(a) a.begin(), a.end()
  31. #define cinv(v) for (auto& x: v) cin >> x
  32. #define fr(i, n) for (int i = 0; i < n; ++i)
  33. #define fl(i, l, n) for (int i = l; i < n; ++i)
  34.  
  35. #define int ll
  36.  
  37. using namespace std;
  38.  
  39. #ifdef __LOCAL
  40. #define dbg(x) cerr << #x << " : " << x << '\n'
  41. const int maxn = 20;
  42. #else
  43. #define dbg(x)
  44. const int maxn = 2e5 + 20;
  45. #endif
  46.  
  47. //tg: @galebickosikasa
  48.  
  49. const ll inf = (ll) 2e9;
  50. const ld pi = asin (1) * 2;
  51. const ld eps = 1e-8;
  52. const ll mod = (ll)1e9 + 7;
  53. const ll ns = 97;
  54.  
  55. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  56.  
  57.  
  58.  
  59. void solve () {
  60. int n, k;
  61. cin >> n >> k;
  62. vector<int> goo (n);
  63. cinv (goo);
  64. if (n == 1) {
  65. if (goo[0] == k) cout << "yes";
  66. else cout << "no";
  67. cout << '\n';
  68. return;
  69. }
  70. int f = 0, t = 0;
  71. for (auto& x: goo) {
  72. // dbg (x);
  73. if (x == k) t = 1;
  74. }
  75.  
  76. fr (i, n) {
  77. if (i > 0) {
  78. if (goo[i] >= k && goo[i - 1] >= k) f = 1;
  79. }
  80. if (i < n - 1) {
  81. if (goo[i] >= k && goo[i + 1] >= k) f = 1;
  82. }
  83. }
  84. fl (i, 2, n) {
  85. if (goo[i] >= k && goo[i - 2] >= k) f = 1;
  86. }
  87. // dbg ("kek");
  88. if (f && t) cout << "yes";
  89. else cout << "no";
  90. cout << '\n';
  91.  
  92.  
  93.  
  94.  
  95. }
  96.  
  97. signed main () {
  98. ios_base::sync_with_stdio(false);
  99. cin.tie(nullptr);
  100. cout.tie(nullptr);
  101. int q = 1;
  102. cin >> q;
  103. while (q--) solve ();
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement