QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#386472#8545. Min or Maxucup-team087#AC ✓3ms4216kbC++2012.8kb2024-04-11 17:08:162024-04-11 17:08:17

Judging History

你现在查看的是最新测评结果

  • [2024-04-11 17:08:17]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:4216kb
  • [2024-04-11 17:08:16]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) \
  vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
  vector<vector<vector<type>>> name( \
      h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)       \
  vector<vector<vector<vector<type>>>> name( \
      a, vector<vector<vector<type>>>(       \
             b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sm = 0;
  for (auto &&a: A) sm += a;
  return sm;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    (check(x) ? ok : ng) = x;
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    (check(x) ? ok : ng) = x;
  }
  return (ok + ng) / 2;
}

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}
#endif
#line 1 "library/other/io.hpp"
#define FASTIO
#include <unistd.h>

// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
  char num[10000][4];
  constexpr Pre() : num() {
    for (int i = 0; i < 10000; i++) {
      int n = i;
      for (int j = 3; j >= 0; j--) {
        num[i][j] = n % 10 | '0';
        n /= 10;
      }
    }
  }
} constexpr pre;

inline void load() {
  memcpy(ibuf, ibuf + pil, pir - pil);
  pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
  pil = 0;
  if (pir < SZ) ibuf[pir++] = '\n';
}

inline void flush() {
  fwrite(obuf, 1, por, stdout);
  por = 0;
}

void rd(char &c) {
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
}

void rd(string &x) {
  x.clear();
  char c;
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
  do {
    x += c;
    if (pil == pir) load();
    c = ibuf[pil++];
  } while (!isspace(c));
}

template <typename T>
void rd_real(T &x) {
  string s;
  rd(s);
  x = stod(s);
}

template <typename T>
void rd_integer(T &x) {
  if (pil + 100 > pir) load();
  char c;
  do
    c = ibuf[pil++];
  while (c < '-');
  bool minus = 0;
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (c == '-') { minus = 1, c = ibuf[pil++]; }
  }
  x = 0;
  while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (minus) x = -x;
  }
}

void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }

template <class T, class U>
void rd(pair<T, U> &p) {
  return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto &x = std::get<N>(t);
    rd(x);
    rd_tuple<N + 1>(t);
  }
}
template <class... T>
void rd(tuple<T...> &tpl) {
  rd_tuple(tpl);
}

template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
  for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
  for (auto &d: x) rd(d);
}

void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
  rd(h), read(t...);
}

void wt(const char c) {
  if (por == SZ) flush();
  obuf[por++] = c;
}
void wt(const string s) {
  for (char c: s) wt(c);
}
void wt(const char *s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; i++) wt(s[i]);
}

template <typename T>
void wt_integer(T x) {
  if (por > SZ - 100) flush();
  if (x < 0) { obuf[por++] = '-', x = -x; }
  int outi;
  for (outi = 96; x >= 10000; outi -= 4) {
    memcpy(out + outi, pre.num[x % 10000], 4);
    x /= 10000;
  }
  if (x >= 1000) {
    memcpy(obuf + por, pre.num[x], 4);
    por += 4;
  } else if (x >= 100) {
    memcpy(obuf + por, pre.num[x] + 1, 3);
    por += 3;
  } else if (x >= 10) {
    int q = (x * 103) >> 10;
    obuf[por] = q | '0';
    obuf[por + 1] = (x - q * 10) | '0';
    por += 2;
  } else
    obuf[por++] = x | '0';
  memcpy(obuf + por, out + outi + 4, 96 - outi);
  por += 96 - outi;
}

template <typename T>
void wt_real(T x) {
  ostringstream oss;
  oss << fixed << setprecision(15) << double(x);
  string s = oss.str();
  wt(s);
}

void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first);
  wt(' ');
  wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define U32(...)   \
  u32 __VA_ARGS__; \
  read(__VA_ARGS__)
#define U64(...)   \
  u64 __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

#line 1 "library/string/is_subseq.hpp"
template <typename STRING>
bool is_subseq(STRING& S, STRING& T) {
  ll p = 0;
  for (auto&& s: S) {
    while (p < len(T) && T[p] != s) ++p;
    if (p == len(T)) return false;
    ++p;
  }
  return true;
}
#line 5 "main.cpp"

void solve() {
  LL(N, M);
  VEC(int, A, N);
  VEC(int, B, M);
  Yes(is_subseq(B, A));
}

signed main() {
  INT(T);
  FOR(T) solve();
  return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

3
2 1
1 2
1
5 4
1 1 1 1 1
1 1 2 1
10 5
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10

output:

Yes
No
Yes

result:

ok 3 tokens

Test #2:

score: 0
Accepted
time: 2ms
memory: 4124kb

input:

13321
7 6
3 3 5 4 1 1 4
4 4 1 3 1 2
10 2
10 5 6 7 10 1 6 1 10 10
10 1
9 6
7 2 1 4 1 6 9 9 3
5 3 1 3 9 1
10 9
8 5 1 5 1 6 10 4 1 6
8 5 1 1 6 10 4 1 6
5 2
1 4 2 4 4
4 5
5 3
4 5 2 5 2
1 5 2
6 3
6 5 3 3 3 1
3 4 4
10 10
7 8 7 4 10 7 3 1 9 4
7 8 7 4 10 7 3 1 9 4
5 5
2 2 1 4 1
2 5 5 4 1
6 6
2 5 3 4 4 3
2 5...

output:

No
Yes
No
Yes
No
No
No
Yes
No
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
No
No
...

result:

ok 13321 tokens

Test #3:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

1342
72 72
37 57 51 3 39 29 21 37 35 65 60 5 64 35 68 47 16 61 25 31 9 30 72 17 46 34 51 62 32 52 18 54 28 37 21 48 39 11 59 39 60 50 21 6 13 37 53 3 31 16 14 27 44 62 9 64 7 1 1 30 15 65 35 43 12 54 5 43 36 31 66 39
37 57 51 3 39 29 21 37 35 65 60 5 64 35 68 47 16 61 25 31 9 30 72 17 46 34 51 62 32...

output:

Yes
No
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
No
Yes
No
No
No
Yes
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
Yes
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
No
No
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
Yes...

result:

ok 1342 tokens

Test #4:

score: 0
Accepted
time: 2ms
memory: 4096kb

input:

136
775 626
753 248 179 17 536 374 505 21 562 392 369 712 463 161 52 718 57 215 155 137 118 768 78 537 101 583 429 91 146 67 738 516 529 256 420 281 549 408 205 330 719 636 651 443 563 683 373 621 653 272 578 599 512 695 709 609 492 220 284 684 429 423 153 642 149 182 563 158 609 743 754 594 660 146...

output:

No
No
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
No
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
No
No
Yes
No
No
Yes
Yes
No
No
No
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
N...

result:

ok 136 tokens

Test #5:

score: 0
Accepted
time: 2ms
memory: 3892kb

input:

12
9836 1392
9603 2209 62 6870 2489 8884 4277 6226 7667 51 1945 5630 8489 3556 9673 5943 1612 3854 5876 7987 89 6025 3803 2622 435 6334 9410 7978 4290 188 9335 392 7735 9296 8521 4391 1704 4342 738 647 5909 1730 1653 8517 7214 8297 4018 9100 5193 8561 9222 8216 5132 2567 1065 352 1557 2251 5363 2078...

output:

No
No
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes

result:

ok 12 tokens

Test #6:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

1
100000 5519
87075 83135 20673 36375 91863 97947 48842 8983 61176 39675 76592 35415 51843 48665 29681 99084 18773 80830 8075 64947 73846 81949 44132 24255 15832 76439 87996 11091 27410 20416 41425 11910 29609 87792 62880 52369 57985 49215 59994 73189 26583 1459 28470 9337 25360 82657 32757 83351 14...

output:

No

result:

ok "No"

Test #7:

score: 0
Accepted
time: 0ms
memory: 4216kb

input:

1
100000 94750
33199 20941 82125 6426 4170 37012 10766 98505 59507 9948 52983 60849 41882 53041 33542 48285 62253 82523 43815 75503 73590 38999 51805 23982 57887 15562 64537 72435 99024 91421 81988 47304 41321 67852 87629 80174 82378 45820 5448 67385 71865 14785 80219 35711 73642 61649 70915 44252 5...

output:

Yes

result:

ok "Yes"

Test #8:

score: 0
Accepted
time: 2ms
memory: 3892kb

input:

1
100000 22735
77994 31898 43842 97824 72348 45560 97801 30802 53851 26388 50113 8675 7206 41938 26845 1592 49990 52778 67925 86882 80376 33085 38095 39295 6594 67435 28816 67233 90961 69405 21339 34598 45214 92955 93123 26259 2490 75078 60056 25490 95015 85131 23031 17406 54850 79078 90915 93765 13...

output:

No

result:

ok "No"

Test #9:

score: 0
Accepted
time: 2ms
memory: 3884kb

input:

1
100000 1112
96856 23945 86921 37753 53087 81648 23274 42236 1140 61205 43048 76608 40236 40194 52269 87211 47840 92646 55537 14653 54340 70154 76091 40269 71239 81828 61970 2129 42610 35282 28908 48214 97388 87483 33378 5382 21881 26724 6581 29215 98289 67654 12786 30063 32214 18271 7095 44024 224...

output:

Yes

result:

ok "Yes"

Test #10:

score: 0
Accepted
time: 3ms
memory: 4096kb

input:

1
100000 36447
50189 49914 49579 755 13384 31623 14212 1333 21857 87724 41852 13753 24811 13862 8407 39590 34551 49467 16678 31572 87858 37396 95098 73467 3875 96792 69912 70156 57277 13543 89803 13601 66691 95083 54785 55307 70244 94333 38649 62957 69445 56488 82489 63958 46568 76504 94054 37522 80...

output:

No

result:

ok "No"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

1
100000 29877
2076 49460 63366 44303 74882 83193 49852 58334 22481 2518 19807 70922 76055 26558 16912 26361 8835 15039 68538 68383 95341 81662 395 33608 51221 89084 81264 19813 61254 3062 72177 87763 29189 72745 91779 54089 71459 13147 54256 41368 14218 77875 37335 58392 67415 18264 44185 82610 434...

output:

Yes

result:

ok "Yes"

Test #12:

score: 0
Accepted
time: 2ms
memory: 4168kb

input:

13323
6 2
2 1 1 2 2 2
2 1
5 1
1 1 2 1 2
1
5 3
1 2 1 1 1
1 2 1
8 3
1 2 2 2 2 1 2 2
2 2 2
7 6
1 2 1 2 1 2 1
1 2 1 2 1 1
6 2
1 2 2 2 1 2
1 1
9 4
2 1 1 3 1 2 3 1 1
1 3 2 1
10 4
2 2 2 2 1 3 2 2 3 2
1 1 3 1
7 2
1 2 1 2 1 2 2
1 1
5 4
1 2 1 1 2
1 2 1 2
7 2
2 2 2 2 2 2 2
2 2
6 2
1 1 2 2 2 1
2 2
5 4
2 1 1 1 2...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Y...

result:

ok 13323 tokens

Test #13:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

1337
57 53
6 4 5 5 7 6 7 4 1 6 6 2 7 5 7 3 1 6 7 3 2 5 7 6 6 6 1 2 2 7 1 1 4 3 2 3 5 7 2 4 4 6 4 3 2 2 4 1 6 1 7 3 5 6 3 4 5
6 4 5 7 6 7 4 1 6 6 2 7 5 7 3 1 6 7 3 2 5 7 6 6 6 1 2 2 7 1 1 4 2 3 5 7 2 4 4 6 3 2 2 1 6 1 7 3 5 6 3 4 5
72 61
5 8 3 1 1 2 1 6 6 4 8 4 4 2 3 1 1 6 6 4 1 6 5 8 5 1 3 8 7 2 4 3...

output:

Yes
No
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
No
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes...

result:

ok 1337 tokens

Test #14:

score: 0
Accepted
time: 2ms
memory: 3876kb

input:

134
889 633
23 29 1 26 22 15 29 4 6 27 4 11 6 7 1 26 12 4 5 7 2 18 28 17 11 28 1 14 16 4 23 23 17 6 14 6 29 13 16 10 26 29 19 5 4 25 13 20 7 4 13 3 19 29 11 6 1 3 29 8 22 19 1 16 18 21 17 28 25 9 22 7 27 25 23 7 12 20 10 5 13 6 8 2 27 22 7 6 10 4 7 7 16 9 11 1 27 8 19 20 2 23 14 7 6 18 22 27 29 16 2...

output:

Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes...

result:

ok 134 tokens

Test #15:

score: 0
Accepted
time: 2ms
memory: 4112kb

input:

13
7570 2419
28 32 47 47 20 60 71 47 30 22 47 85 1 14 59 20 19 26 82 31 33 87 66 20 67 85 76 10 10 16 27 70 42 81 59 47 23 9 62 11 58 24 16 63 29 15 78 86 8 3 65 2 6 80 64 77 65 8 36 61 87 61 40 86 17 57 31 17 63 71 32 32 5 4 28 87 87 60 26 64 41 58 64 29 83 64 16 16 19 40 12 20 19 44 87 63 22 16 10...

output:

Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No

result:

ok 13 tokens

Test #16:

score: 0
Accepted
time: 3ms
memory: 3800kb

input:

1
100000 81360
57 187 18 36 115 259 88 293 168 8 97 260 97 228 36 68 79 276 290 11 84 159 227 175 274 312 256 134 67 264 53 224 15 245 13 37 64 115 316 261 118 82 241 28 150 305 162 87 299 73 35 151 147 110 45 118 171 231 95 111 170 188 211 260 116 271 197 187 204 262 133 220 128 104 124 43 129 267 ...

output:

Yes

result:

ok "Yes"

Test #17:

score: 0
Accepted
time: 2ms
memory: 3860kb

input:

1
100000 32667
166 18 175 98 15 44 114 223 71 49 218 207 52 274 23 267 298 217 179 55 25 188 229 179 51 230 80 112 93 225 221 115 147 29 68 98 142 224 39 125 290 62 179 87 150 42 100 260 14 19 238 64 172 241 243 279 250 159 23 144 209 133 17 31 217 212 141 262 148 195 209 312 219 232 84 38 4 130 244...

output:

No

result:

ok "No"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

1
100000 18179
168 267 61 281 22 255 249 130 208 33 202 70 182 200 13 272 114 14 299 235 19 181 274 11 278 69 17 155 207 87 175 38 189 95 153 120 90 1 95 151 178 166 126 15 250 103 133 128 46 94 48 211 18 164 227 240 93 56 63 162 263 251 180 194 27 21 173 113 51 172 214 255 38 71 141 305 281 259 252...

output:

No

result:

ok "No"

Test #19:

score: 0
Accepted
time: 0ms
memory: 4148kb

input:

1
100000 7602
160 137 278 78 58 288 270 65 238 4 211 135 313 180 82 269 9 310 201 103 268 176 233 188 7 92 36 201 95 65 218 91 273 197 63 124 208 176 222 287 112 165 250 297 258 233 63 84 301 135 151 307 211 61 67 171 256 154 102 245 93 222 96 268 262 173 175 115 61 253 226 299 203 178 169 255 181 2...

output:

Yes

result:

ok "Yes"

Test #20:

score: 0
Accepted
time: 3ms
memory: 4000kb

input:

1
100000 43048
241 131 79 227 44 82 105 214 27 13 213 38 255 3 311 310 201 191 69 269 174 172 173 17 74 227 36 84 158 189 49 275 169 149 123 58 218 166 118 204 299 177 246 194 193 223 195 46 204 308 85 106 238 288 91 194 225 247 21 256 218 230 175 27 176 283 110 120 55 103 172 109 17 106 261 65 225 ...

output:

Yes

result:

ok "Yes"

Test #21:

score: 0
Accepted
time: 3ms
memory: 3968kb

input:

1
100000 88743
284 302 282 301 258 197 12 203 219 301 120 213 164 14 208 266 62 259 87 248 228 233 248 151 269 274 245 100 12 287 37 1 238 182 76 150 81 86 272 85 301 312 178 294 57 59 244 144 156 142 200 80 266 277 146 92 158 101 215 182 206 256 85 77 22 264 244 237 152 140 105 29 162 122 84 133 99...

output:

No

result:

ok "No"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

1
1 1
1
1

output:

Yes

result:

ok "Yes"

Extra Test:

score: 0
Extra Test Passed