QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#775499#9788. Shrecklessucup-team5243#TL 1303ms5064kbC++2311.4kb2024-11-23 16:05:362024-11-23 16:05:36

Judging History

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

  • [2024-11-23 16:05:36]
  • 评测
  • 测评结果:TL
  • 用时:1303ms
  • 内存:5064kb
  • [2024-11-23 16:05:36]
  • 提交

answer

//line 1 "answer.cpp"
#if !__INCLUDE_LEVEL__
#include __FILE__
int solve() {
    ll n,m; input(n, m);
    auto a = vv<ll>(n, m); input(a);
    {
        vl c; rep(i, n) c.push_back(a[i][0]);
        sort(all(c));
        rep(i, n) a[i][0] = c[i];
    }
    ll r = n;
    rep(i, 1, m) {
        if (r == 0) break;
        vl c; rep(j, n) {c.push_back(a[j][i]); a[j][i] = -1;}
        sort(all(c)); reverse(all(c));
        rep(j, r) {
            if (a[j][i-1] > c.back()) {a[j][i] = c.back(); c.pop_back();}
        }
        debug(c);
        ll rn = r;
        rep(j, r-1, -1, -1) {
            if (a[j][i] != -1) {swap(a[j], a[--rn]);}
        }
        for (auto row : a) debug(row);
        swap(r, rn);
        reverse(all(c));
        ll p = 0;
        rep(j, r, n) if (a[j][i] == -1) {a[j][i] = c[p++];}
        rep(j, r) if (a[j][i] == -1) {a[j][i] = c[p++];}
        debug(r);
        for (auto row : a) debug(row);
        debug("---");
    }
    for (auto row : a) debug(row);
    YES(r == 0);
    return 0;
}
int main() {
    ll t; input(t);
    rep(t) solve();
}
#else
//line 2 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/std.hpp"
#include <bits/stdc++.h>
#ifndef LOCAL_TEST
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif // LOCAL_TEST
using namespace std;
using std::cout;
// shorten typenames
using ll = long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>;  using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>;  using vvl = vector<vl>; using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using vs = vector<string>; using vvs = vector<vector<string>>; using vvvs = vector<vector<vector<string>>>;
template<typename T> vector<vector<T>> vv(int h, int w, T val = T()) { return vector(h, vector<T>(w, val)); }
template<typename T> vector<vector<vector<T>>> vvv(int h1, int h2, int h3, T val = T()) { return vector(h1, vector(h2, vector<T>(h3, val))); }
template<typename T> vector<vector<vector<vector<T>>>> vvvv(int h1, int h2, int h3, int h4, T val = T()) { return vector(h1, vector(h2, vector(h3, vector<T>(h4, val)))); }
template <class T> using priority_queue_min = priority_queue<T, vector<T>, greater<T>>;
// define CONSTANTS
constexpr double PI = 3.14159265358979323;
constexpr int INF = 100100111; constexpr ll INFL = 3300300300300300491LL;
float EPS = 1e-8; double EPSL = 1e-10;
template<typename T> bool eq(const T x, const T y) { return x == y; }
template<> bool eq<double>(const double x, const double y) { return (abs(x - y) < EPSL * x || abs(x - y) < EPSL); }
template<> bool eq<float>(const float x, const float y) { return abs(x - y) < EPS * x; }
template<typename T> bool neq(const T x, const T y) { return !(eq<T>(x, y)); }
template<typename T> bool ge(const T x, const T y) { return (eq<T>(x, y) || (x > y)); }
template<typename T> bool le(const T x, const T y) { return (eq<T>(x, y) || (x < y)); }
template<typename T> bool gt(const T x, const T y) { return !(le<T>(x, y)); }
template<typename T> bool lt(const T x, const T y) { return !(ge<T>(x, y)); }
constexpr int MODINT998244353 = 998244353;
constexpr int MODINT1000000007 = 1000000007;
// fasten io
struct Nyan { Nyan() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } nyan;
// define macros
#define all(a) (a).begin(), (a).end()
#define sz(x) ((ll)(x).size())
#define rep1(n) for(ll dummy_iter = 0LL; dummy_iter < n; ++dummy_iter) // 0,1,...,n-1
#define rep2(i, n) for(ll i = 0LL, i##_counter = 0LL; i##_counter < ll(n); ++(i##_counter), (i) = i##_counter) // i=0,1,...,n-1
#define rep3(i, s, t) for(ll i = ll(s), i##_counter = ll(s); i##_counter < ll(t); ++(i##_counter), (i) = (i##_counter)) // i=s,s+1,...,t-1
#define rep4(i, s, t, step) for(ll i##_counter = step > 0 ? ll(s) : -ll(s), i##_end = step > 0 ? ll(t) : -ll(t), i##_step = abs(step), i = ll(s); i##_counter < i##_end; i##_counter += i##_step, i = step > 0 ? i##_counter : -i##_counter) // i=s,s+step,...,<t
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define repe(a, v) for(auto& a : (v)) // iterate over all elements in v
#define smod(n, m) ((((n) % (m)) + (m)) % (m))
#define sdiv(n, m) (((n) - smod(n, m)) / (m))
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());}
int Yes(bool b=true) { cout << (b ? "Yes\n" : "No\n"); return 0; };
int YES(bool b=true) { cout << (b ? "YES\n" : "NO\n"); return 0; };
int No(bool b=true) {return Yes(!b);};
int NO(bool b=true) {return YES(!b);};
template<typename T, size_t N> T max(array<T, N>& a) { return *max_element(all(a)); };
template<typename T, size_t N> T min(array<T, N>& a) { return *min_element(all(a)); };
template<typename T> T max(vector<T>& a) { return *max_element(all(a)); };
template<typename T> T min(vector<T>& a) { return *min_element(all(a)); };
template<typename T> vector<T> vec_slice(const vector<T>& a, int l, int r) { vector<T> rev; rep(i, l, r) rev.push_back(a[i]); return rev; };
template<typename T> T sum(vector<T>& a, T zero = T(0)) { T rev = zero; rep(i, sz(a)) rev += a[i]; return rev; };
template<typename T> bool in_range(const T& val, const T& s, const T& t) { return s <= val && val < t; };

template <class T> inline vector<T>& operator--(vector<T>& v) { repe(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repe(x, v) ++x; return v; }

ll powm(ll a, ll n, ll mod=INFL) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        if (n > 1) a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
ll sqrtll(ll x) {
    assert(x >= 0);
    ll rev = sqrt(x);
    while(rev * rev > x) --rev;
    while((rev+1) * (rev+1)<=x) ++rev;
    return rev;
}
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; }
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; }
int digit(ll x, int d=10) { int rev=0; while (x > 0) { rev++; x /= d;}; return rev; }
/**
 * @brief std.hpp
 * @docs docs/std/std.md
 */
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/io.hpp"
// overload operators (prototypes)
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p);
template <class T> inline istream& operator>>(istream& is, vector<T>& v);
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v);
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp);
template <typename T> ostream &operator<<(ostream &os, const set<T> &st);
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st);
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st);
template <typename T> ostream &operator<<(ostream &os, queue<T> q);
template <typename T> ostream &operator<<(ostream &os, deque<T> q);
template <typename T> ostream &operator<<(ostream &os, stack<T> st);
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq);

// overload operators
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repe(x, v) is >> x; return is; }
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { os << v.at(i); if (i != sz(v) - 1) os << " "; } return os; }
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st) { ll cnt = 0; for (auto &e : st) { os << e << (++cnt != (int)st.size() ? " " : ""); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front(); q.pop_front(); if (q.size()) os << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; }
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; }

template <typename T> int print_sep_end(string sep, string end, const T& val) { (void)sep; cout << val << end; return 0; };
template <typename T1, typename... T2> int print_sep_end(string sep, string end, const T1 &val, const T2 &...remain) {
    cout << val << sep;
    print_sep_end(sep, end, remain...);
    return 0;
};
template <typename... T> int print(const T &...args) { print_sep_end(" ", "\n", args...); return 0; };
template <typename... T> void flush() { cout << flush; };
template <typename... T> int print_and_flush(const T &...args) { print(args...); flush(); return 0; };
#define debug(...) debug_func(0, #__VA_ARGS__, __VA_ARGS__) // debug print
template <typename T> void input(T &a) { cin >> a; };
template <typename T1, typename... T2> void input(T1&a, T2 &...b) { cin >> a; input(b...); };
#ifdef LOCAL_TEST
template <typename T> void debug_func(int i, const T name) { (void)i; (void)name; cerr << endl; }
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, const T2 &a, const T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, T2 &a, T3 &...b) {
    int scope = 0;
    for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
        cerr << name[i];
        if (name[i] == '(' || name[i] == '{') scope++;
        if (name[i] == ')' || name[i] == '}') scope--;
    }
    cerr << ":" << a << " ";
    debug_func(i + 1, name, b...);
}
#endif
#ifndef LOCAL_TEST
template <typename... T>
void debug_func(T &...) {}
template <typename... T>
void debug_func(const T &...) {}
#endif
/**
 * @brief io.hpp
 * @docs docs/std/io.md
 */
//line 45 "answer.cpp"
#endif

詳細信息

Test #1:

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

input:

3
2 2
69 69
2024 42
3 3
1 1 1
1 1 1
2 2 2
3 4
1 1 1 1
1 1 1 1
2 2 2 2

output:

YES
NO
YES

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

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

input:

3
2 2
69 69
2024 42
3 3
1 1 1
1 1 1
2 2 2
3 4
1 1 1 1
1 1 1 1
2 2 2 2

output:

YES
NO
YES

result:

ok 3 token(s): yes count is 2, no count is 1

Test #3:

score: 0
Accepted
time: 20ms
memory: 3848kb

input:

20000
6 2
12 4
8 24
2 10
1 22
3 15
18 20
3 3
3 8 18
2 17 15
13 4 6
3 3
7 17 15
8 6 3
18 13 9
3 3
2 3 14
1 7 17
4 6 13
3 3
6 10 14
3 9 13
1 7 15
2 4
1 3 16 14
6 10 4 2
3 3
3 2 17
7 11 13
16 5 18
2 3
2 3 6
4 1 5
2 4
4 6 13 14
2 11 12 16
3 3
2 8 12
4 9 17
5 7 18
3 2
5 10
8 9
1 6
2 2
2 4
1 3
2 3
12 6 1
...

output:

NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
N...

result:

ok 20000 token(s): yes count is 10263, no count is 9737

Test #4:

score: 0
Accepted
time: 20ms
memory: 3780kb

input:

20000
5 2
10 4
13 17
20 19
14 11
3 12
3 4
21 15 12 18
6 19 16 24
11 10 8 22
3 3
6 14 16
15 9 13
8 4 12
2 4
8 5 9 15
4 3 6 10
2 4
1 4 13 14
11 2 9 15
3 2
8 1
2 9
12 5
3 4
8 10 14 23
7 12 13 18
4 9 16 19
3 4
2 5 18 22
3 17 15 24
4 11 8 23
3 3
9 13 12
16 10 8
11 5 18
3 4
2 16 13 15
1 5 12 23
3 7 17 24
...

output:

NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
...

result:

ok 20000 token(s): yes count is 10265, no count is 9735

Test #5:

score: 0
Accepted
time: 20ms
memory: 3720kb

input:

20000
3 4
16 14 12 15
7 9 17 23
3 21 8 22
3 3
4 9 1
16 2 7
13 15 14
3 3
2 7 10
6 14 17
1 9 18
3 4
1 8 13 23
4 10 11 15
2 7 17 19
3 4
8 9 10 19
3 14 22 13
6 20 18 24
3 3
6 14 7
2 11 13
8 10 12
3 4
5 9 13 21
2 7 10 24
4 6 16 17
3 4
2 6 11 21
13 19 9 12
1 10 14 23
2 5
3 8 11 13 15
6 7 9 12 14
2 3
6 9 1...

output:

YES
YES
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
Y...

result:

ok 20000 token(s): yes count is 10239, no count is 9761

Test #6:

score: 0
Accepted
time: 20ms
memory: 3640kb

input:

20000
4 2
2 10
3 12
5 14
9 13
2 3
1 7 11
3 5 9
2 3
5 4 3
2 9 8
3 4
14 5 20 21
8 15 12 10
4 11 23 17
2 3
3 7 5
8 2 6
4 2
16 11
10 9
8 15
13 3
3 3
4 7 17
5 6 14
9 10 16
5 2
5 16
1 10
11 15
14 12
6 19
2 4
3 6 4 16
4 13 8 15
2 3
2 7 10
5 6 9
3 3
13 12 16
10 6 17
2 14 15
3 3
11 5 13
2 1 7
6 9 14
3 4
5 13...

output:

NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
N...

result:

ok 20000 token(s): yes count is 10265, no count is 9735

Test #7:

score: 0
Accepted
time: 20ms
memory: 3640kb

input:

20000
3 2
3 8
1 9
10 12
3 3
7 2 1
3 6 8
18 15 4
2 3
6 8 10
5 9 11
2 4
3 5 16 13
2 4 7 11
2 4
8 6 3 4
11 10 9 14
3 3
7 3 12
4 13 18
16 10 15
2 6
3 11 12 14 17 20
1 6 18 9 19 21
5 2
17 8
2 16
5 20
3 18
9 12
2 4
1 7 9 14
3 4 11 12
3 4
3 12 23 8
4 19 10 21
11 6 16 15
2 4
2 4 8 16
1 5 13 14
3 3
4 8 9
6 1...

output:

NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
N...

result:

ok 20000 token(s): yes count is 10355, no count is 9645

Test #8:

score: 0
Accepted
time: 19ms
memory: 3660kb

input:

1000
56 3
22 260 202
59 232 256
12 84 309
129 171 317
93 238 313
46 237 174
53 272 310
37 95 229
141 161 327
50 146 216
32 203 262
85 219 320
13 207 332
43 86 284
65 230 336
9 210 271
68 263 205
48 193 240
145 64 235
15 269 322
126 223 162
3 70 281
120 110 246
104 155 267
102 159 331
134 139 253
20 ...

output:

NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
...

result:

ok 1000 token(s): yes count is 469, no count is 531

Test #9:

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

input:

1000
56 3
168 90 271
147 230 233
44 113 327
32 214 333
57 251 298
13 117 312
109 61 293
165 137 273
99 248 187
171 183 326
55 227 217
75 263 264
6 104 242
15 265 278
139 84 292
48 122 252
154 218 296
37 131 284
19 181 294
89 211 285
69 172 318
11 260 212
33 234 308
142 180 309
49 53 208
178 270 282
...

output:

NO
NO
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
N...

result:

ok 1000 token(s): yes count is 497, no count is 503

Test #10:

score: 0
Accepted
time: 19ms
memory: 3740kb

input:

1000
28 7
35 110 142 174 274 311 378
41 56 113 221 265 297 383
20 76 129 245 242 347 353
10 89 128 194 249 301 389
55 97 119 202 231 302 381
65 73 150 216 268 339 364
45 75 126 235 282 338 343
9 102 136 187 229 328 391
62 127 170 171 277 344 350
32 96 144 186 256 309 375
42 64 139 179 279 336 368
26...

output:

NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
...

result:

ok 1000 token(s): yes count is 441, no count is 559

Test #11:

score: 0
Accepted
time: 14ms
memory: 3736kb

input:

1000
52 3
2 187 257
104 159 268
40 117 293
95 128 170
116 240 311
78 137 236
99 237 279
65 196 289
48 191 156
133 254 219
53 218 182
20 79 244
29 123 209
33 174 296
17 94 306
74 96 283
147 132 201
118 202 292
112 171 281
16 121 172
129 63 146
43 83 301
127 109 275
25 233 274
18 200 305
27 157 269
97...

output:

NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
Y...

result:

ok 1000 token(s): yes count is 450, no count is 550

Test #12:

score: 0
Accepted
time: 19ms
memory: 3672kb

input:

1000
14 15
5 46 76 94 132 146 170 203 222 275 297 321 360 364 416
21 22 71 103 124 142 160 190 237 262 287 320 349 394 404
9 31 53 108 113 138 179 188 233 260 300 326 347 377 411
1 51 52 96 117 155 181 213 241 252 285 310 362 385 396
19 38 73 106 131 151 169 200 234 270 284 318 337 380 399
11 32 66 ...

output:

NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 473, no count is 527

Test #13:

score: 0
Accepted
time: 15ms
memory: 3608kb

input:

1000
33 6
56 132 215 277 315 361
36 138 204 299 325 386
6 94 192 240 321 375
3 75 156 238 284 378
52 98 177 232 309 370
44 127 174 249 311 385
70 111 142 252 333 353
99 165 227 211 297 343
41 115 231 207 273 345
37 120 221 229 323 396
51 109 200 218 308 340
40 107 171 272 316 377
67 168 196 282 266 ...

output:

YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
N...

result:

ok 1000 token(s): yes count is 489, no count is 511

Test #14:

score: 0
Accepted
time: 18ms
memory: 3736kb

input:

1000
13 14
4 28 58 79 104 125 152 169 211 266 273 297 323 358
15 25 71 88 102 133 154 187 203 260 294 301 324 348
6 49 68 81 118 146 168 193 243 239 277 296 337 342
24 44 59 82 99 122 163 202 231 255 269 303 316 344
17 41 62 93 108 143 144 182 224 253 289 295 315 347
21 34 52 70 105 142 151 200 226 ...

output:

NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
...

result:

ok 1000 token(s): yes count is 473, no count is 527

Test #15:

score: 0
Accepted
time: 18ms
memory: 3728kb

input:

1000
14 14
41 45 76 113 144 145 200 232 241 279 298 299 357 380
3 51 67 119 146 164 179 214 243 272 289 306 333 391
21 43 91 114 127 160 190 231 245 266 292 313 352 389
4 42 87 118 128 174 189 218 234 273 293 315 348 382
24 68 86 108 139 163 204 217 264 269 282 318 353 383
31 44 84 88 151 156 196 22...

output:

YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
...

result:

ok 1000 token(s): yes count is 425, no count is 575

Test #16:

score: 0
Accepted
time: 19ms
memory: 3736kb

input:

1000
21 9
45 74 131 177 185 263 282 337 344
33 84 114 164 211 249 277 352 353
31 69 97 149 176 254 283 302 363
14 82 105 145 168 242 284 325 375
7 64 121 147 195 258 285 343 362
38 78 90 165 208 269 265 318 357
15 70 116 179 206 231 305 347 355
32 39 130 175 180 238 298 328 351
11 43 83 161 217 261 ...

output:

NO
NO
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
N...

result:

ok 1000 token(s): yes count is 457, no count is 543

Test #17:

score: 0
Accepted
time: 19ms
memory: 3612kb

input:

1000
6 36
4 28 34 52 63 70 77 89 95 107 125 128 145 159 175 187 194 212 230 240 251 258 272 287 303 311 328 340 335 349 364 381 384 398 403 426
8 30 42 49 56 65 75 87 98 114 127 137 144 170 179 185 196 207 232 244 254 260 277 289 297 319 329 334 343 350 363 371 388 401 405 432
1 32 37 55 61 69 79 91...

output:

NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
...

result:

ok 1000 token(s): yes count is 464, no count is 536

Test #18:

score: 0
Accepted
time: 22ms
memory: 3732kb

input:

50
62 62
34 198 257 495 599 702 807 942 1102 1224 1296 1407 1560 1623 1771 1894 1978 2125 2203 2361 2539 2684 2749 2887 3017 3104 3261 3333 3528 3590 3752 3878 3921 4063 4194 4395 4522 4565 4702 4841 4971 5083 5265 5443 5532 5691 5739 5909 6052 6198 6315 6419 6545 6731 6836 6956 7009 7204 7278 7345 ...

output:

NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO

result:

ok 50 token(s): yes count is 23, no count is 27

Test #19:

score: 0
Accepted
time: 24ms
memory: 3796kb

input:

50
63 63
115 189 304 375 570 662 753 889 941 1119 1259 1361 1395 1575 1761 1878 2017 2108 2224 2351 2435 2603 2816 2926 2965 3097 3284 3388 3512 3731 3845 3931 4031 4145 4339 4475 4593 4638 4778 4910 5032 5234 5321 5451 5571 5753 5855 5960 6145 6182 6412 6553 6590 6773 6889 7034 7135 7291 7355 7455 ...

output:

NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO

result:

ok 50 token(s): yes count is 25, no count is 25

Test #20:

score: 0
Accepted
time: 25ms
memory: 3804kb

input:

50
315 12
385 1013 1757 2325 2584 3524 4154 4338 4939 6166 6819 7231
288 798 1283 1921 2732 3457 3926 4867 5283 5557 6641 7464
162 641 1728 1911 2366 3395 3814 4823 5189 6129 6476 6949
110 864 1497 1886 2482 3574 4105 4626 5577 5904 6910 7000
394 989 1593 2022 2972 3225 3801 4584 5256 5976 6399 6879...

output:

YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
YES

result:

ok 50 token(s): yes count is 25, no count is 25

Test #21:

score: 0
Accepted
time: 24ms
memory: 3764kb

input:

50
441 9
543 1572 2713 3054 3720 5123 5376 6901 7710
876 1343 2413 3656 3605 5072 5923 6246 7336
305 1399 2258 2705 4191 5327 5736 6887 7527
121 1109 2402 2859 3920 4826 5867 6685 7323
213 1528 1808 3327 4205 4375 5790 6745 7457
790 1083 2399 3266 3736 4910 6075 6322 7853
189 1848 1926 3278 4217 495...

output:

YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO

result:

ok 50 token(s): yes count is 25, no count is 25

Test #22:

score: 0
Accepted
time: 24ms
memory: 3732kb

input:

50
63 63
67 217 278 432 643 733 811 964 1144 1229 1322 1443 1507 1638 1882 1926 2084 2227 2356 2448 2601 2664 2792 3014 3021 3220 3335 3463 3622 3768 3846 4025 4192 4277 4431 4549 4645 4795 4786 4936 5105 5178 5413 5526 5558 5793 5921 5933 6132 6197 6416 6551 6617 6791 6820 6957 7146 7244 7344 7459 ...

output:

NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES

result:

ok 50 token(s): yes count is 27, no count is 23

Test #23:

score: 0
Accepted
time: 24ms
memory: 3736kb

input:

50
378 10
201 1163 2312 2200 3221 3881 4950 6071 6047 7159
403 978 2149 2406 3268 4195 5260 5817 6134 7463
696 1204 2210 2365 3460 3699 4703 5759 6175 7497
249 1175 2026 2831 3329 4173 5154 5506 6506 7413
644 776 1886 2605 3778 4228 4987 5677 6843 6822
546 971 1840 2993 3531 3891 4983 5133 6001 7395...

output:

NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO

result:

ok 50 token(s): yes count is 26, no count is 24

Test #24:

score: 0
Accepted
time: 20ms
memory: 3768kb

input:

50
10 395
14 30 75 78 103 113 151 158 198 209 225 252 267 292 313 322 350 378 392 399 436 453 468 494 531 534 586 600 606 628 656 674 701 717 734 742 761 809 813 833 846 863 892 913 919 954 974 989 997 1029 1045 1052 1079 1103 1119 1129 1162 1181 1198 1214 1240 1257 1275 1293 1303 1335 1346 1377 138...

output:

NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES

result:

ok 50 token(s): yes count is 26, no count is 24

Test #25:

score: 0
Accepted
time: 23ms
memory: 3680kb

input:

50
372 10
47 830 1739 2183 3176 4172 5058 5700 6016 7120
259 811 1730 2731 2981 3861 4819 5856 6584 7254
266 907 1392 2261 3163 3954 4607 5757 6382 6817
565 1393 1922 2256 2972 3667 5141 5825 6342 7043
123 1411 1719 2703 3484 3794 4543 5532 5963 6802
148 1146 2131 2904 3456 4381 4517 5875 6586 7438
...

output:

NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
YES
NO
NO

result:

ok 50 token(s): yes count is 29, no count is 21

Test #26:

score: 0
Accepted
time: 24ms
memory: 3824kb

input:

50
189 21
52 577 868 1218 1715 2034 2453 2868 3184 3396 3783 4326 4563 4991 5301 5644 6228 6626 6949 7352 7876
256 611 1029 1424 1821 2235 2543 2661 3042 3651 3837 4387 4684 5149 5329 5817 6337 6549 7117 7516 7653
248 566 1126 1138 1660 2188 2358 2739 3130 3543 4030 4410 4901 5103 5636 5845 6073 653...

output:

NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO

result:

ok 50 token(s): yes count is 23, no count is 27

Test #27:

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

input:

50
5 803
8 22 30 42 57 58 65 84 93 100 102 108 122 149 160 162 174 190 198 206 209 219 228 237 252 265 273 286 289 295 300 308 327 336 345 349 365 372 391 399 411 418 426 442 455 459 465 479 493 507 525 526 533 552 553 569 576 579 588 596 604 610 619 629 633 642 652 657 674 681 698 711 726 731 740 7...

output:

NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES

result:

ok 50 token(s): yes count is 30, no count is 20

Test #28:

score: 0
Accepted
time: 63ms
memory: 3952kb

input:

5
200 200
15 671 1037 1476 2036 2395 2736 2886 3297 3666 4279 4636 5033 5595 5835 6251 6823 7097 7350 7744 8170 8644 8844 9470 10025 10324 10637 10978 11216 11856 12158 12640 13177 13514 13850 14355 14579 15062 15338 15719 16357 16504 17121 17539 18025 18310 18553 19133 19519 19764 20293 20658 21213...

output:

NO
YES
YES
NO
YES

result:

ok 5 token(s): yes count is 3, no count is 2

Test #29:

score: 0
Accepted
time: 27ms
memory: 4228kb

input:

5
199 200
18 381 972 1353 1713 2366 2728 2933 3568 3688 4114 4621 5137 5488 5656 6099 6424 6851 7441 7804 8163 8670 8846 9301 9663 10176 10318 11052 11396 11789 12264 12417 13085 13246 13733 14200 14519 15103 15261 15826 16123 16590 16801 17270 17814 17991 18595 18810 19522 19838 20116 20585 20793 2...

output:

YES
NO
NO
YES
NO

result:

ok 5 token(s): yes count is 2, no count is 3

Test #30:

score: 0
Accepted
time: 462ms
memory: 4052kb

input:

5
1200 33
1109 3084 6343 7352 11845 13407 16744 17637 20075 23140 25875 28335 30532 32845 33836 37168 40118 40577 43809 46887 48735 51417 54133 56582 59691 60809 63687 65320 67861 70140 73310 74862 79046
1854 4538 5276 8213 9605 14236 15800 17677 19669 21926 24613 28540 28946 32185 34395 37012 40297...

output:

YES
NO
YES
NO
NO

result:

ok 5 token(s): yes count is 2, no count is 3

Test #31:

score: 0
Accepted
time: 214ms
memory: 3908kb

input:

5
3 13370
6 8 13 19 21 30 37 40 48 52 53 57 60 65 69 78 82 85 87 95 107 118 121 123 128 132 137 141 152 156 165 173 178 188 191 196 203 209 213 223 232 233 245 248 258 267 271 278 281 284 293 299 302 306 323 328 335 336 344 348 352 360 369 377 389 392 394 404 413 417 419 424 431 436 437 448 457 465 ...

output:

NO
NO
YES
YES
YES

result:

ok 5 token(s): yes count is 3, no count is 2

Test #32:

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

input:

5
199 200
322 717 873 1330 1689 2388 2640 2893 3501 3803 4298 4425 5045 5448 5605 5979 6417 6862 7482 7715 7923 8594 8944 9414 9705 9895 10539 10863 11338 11514 12100 12383 12895 13417 13466 13981 14386 15052 15223 15691 15929 16432 16671 17427 17491 18135 18320 18691 19180 19689 20061 20704 21138 2...

output:

NO
YES
YES
NO
YES

result:

ok 5 token(s): yes count is 3, no count is 2

Test #33:

score: 0
Accepted
time: 26ms
memory: 4200kb

input:

5
200 200
319 416 984 1379 1640 2382 2581 3152 3343 3900 4061 4538 5034 5598 5872 6246 6703 7125 7262 7761 8098 8766 8821 9556 9793 10057 10383 10825 11476 11622 11972 12722 12835 13133 13599 14198 14607 14798 15248 15686 15902 16444 16882 17388 17740 17919 18532 18734 19228 19817 19966 20496 21054 ...

output:

YES
NO
NO
YES
YES

result:

ok 5 token(s): yes count is 3, no count is 2

Test #34:

score: 0
Accepted
time: 215ms
memory: 4040kb

input:

5
199 199
85 604 880 1275 1554 2320 2534 2962 3300 3714 4033 4721 4930 5298 5939 6064 6559 6999 7266 7923 8050 8739 9178 9308 9926 10136 10821 11059 11408 11924 12160 12754 13196 13255 13893 14079 14596 14882 15380 15855 16121 16519 17170 17224 17629 18346 18380 18844 19179 19926 20273 20664 20878 2...

output:

NO
YES
YES
NO
NO

result:

ok 5 token(s): yes count is 2, no count is 3

Test #35:

score: 0
Accepted
time: 304ms
memory: 4172kb

input:

5
4004 10
7592 16501 22358 26746 39214 39330 54628 62444 68924 71720
3720 8802 15946 28293 32586 48525 50881 63175 71662 72527
5349 13113 19647 28946 35497 46905 54548 57980 65260 78383
8225 12311 23742 28406 31895 41807 53676 61619 69053 79939
1855 14892 21743 32291 39498 47078 53674 62031 70851 79...

output:

YES
NO
YES
YES
YES

result:

ok 5 token(s): yes count is 4, no count is 1

Test #36:

score: 0
Accepted
time: 317ms
memory: 4240kb

input:

5
2 20046
3 7 10 12 15 16 19 25 26 30 33 38 40 49 51 56 66 68 72 74 79 80 85 90 92 94 96 106 110 114 116 123 124 130 134 138 146 149 153 157 160 172 176 183 192 201 204 208 209 211 214 217 221 222 229 230 234 240 242 245 247 254 256 257 261 267 270 274 279 290 299 304 310 314 317 319 322 326 327 331...

output:

NO
YES
YES
YES
NO

result:

ok 5 token(s): yes count is 3, no count is 2

Test #37:

score: 0
Accepted
time: 129ms
memory: 4056kb

input:

5
8 4939
12 36 61 73 88 98 123 133 142 171 175 192 225 239 251 280 300 316 324 339 372 386 396 415 422 447 466 488 492 502 527 548 554 581 593 611 614 628 651 661 682 698 721 735 763 770 781 792 806 819 835 849 874 890 906 916 939 952 976 988 997 1016 1031 1054 1060 1073 1096 1103 1123 1144 1157 117...

output:

NO
YES
NO
NO
YES

result:

ok 5 token(s): yes count is 2, no count is 3

Test #38:

score: 0
Accepted
time: 1303ms
memory: 5064kb

input:

1
5 39985
7 16 24 33 35 43 61 78 79 93 100 110 111 130 138 147 162 175 187 200 204 219 224 230 241 254 275 278 295 303 326 332 345 352 363 373 376 383 402 409 435 442 451 460 466 470 483 488 499 504 514 523 532 543 563 573 580 582 597 612 625 635 640 646 659 668 685 695 703 708 715 719 740 747 759 7...

output:

YES

result:

ok YES

Test #39:

score: 0
Accepted
time: 1126ms
memory: 4872kb

input:

1
9 22219
14 20 52 56 82 98 115 133 150 159 185 204 213 232 243 262 280 293 313 327 346 382 396 423 434 449 458 484 501 512 524 551 571 596 601 630 639 661 671 712 725 745 758 766 783 816 820 858 875 888 905 918 926 952 980 989 999 1023 1037 1067 1079 1095 1109 1131 1138 1176 1183 1199 1219 1234 125...

output:

YES

result:

ok YES

Test #40:

score: -100
Time Limit Exceeded

input:

1
3 66636
7 12 18 23 28 30 42 51 64 65 73 78 82 87 94 97 108 115 122 125 126 136 139 144 150 155 162 163 171 192 196 204 212 215 221 223 228 235 241 251 257 265 273 277 284 288 301 309 310 321 324 330 337 340 348 355 364 370 373 375 379 381 389 395 398 402 406 412 415 421 434 440 443 444 455 460 462...

output:


result: