QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179573#6400. Game: Celesteucup-team1600RE 604ms409404kbC++206.8kb2023-09-14 22:26:242023-09-14 22:26:24

Judging History

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

  • [2023-09-14 22:26:24]
  • 评测
  • 测评结果:RE
  • 用时:604ms
  • 内存:409404kb
  • [2023-09-14 22:26:24]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#ifdef LOCAL
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>
#else
#include <bits/stdc++.h>
#endif

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
inline bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL

const int max_n = 2e7 + 11, inf = 1000111222;


struct num {
    static const int MA = 1e9 + 7, MB = 1e9 + 9;

    int a, b;

    num() : a(0), b(0) { }
    num( int x ) : a(x), b(x) { }
    num( int a, int b ) : a(a), b(b) { }

    num operator + ( const num &x ) const { return num((a + x.a) % MA, (b + x.b) % MB); }
    num operator - ( const num &x ) const { return num((a + MA - x.a) % MA, (b + MB - x.b) % MB); }
    num operator * ( int x ) const { return num(((ll)a * x) % MA, ((ll)b * x) % MB); }
    num operator * ( const num &x ) const { return num(((ll)a * x.a) % MA, ((ll)b * x.b) % MB); }
    bool operator == ( const num &x ) const { return a == x.a && b == x.b; }
    bool operator != ( const num &x ) const { return !(a == x.a && b == x.b); }

};


struct node {
    int l, r, cnt;
    num h;
    node () : h(1), cnt(0), l(0), r(0) {}
};

node t[max_n] = {};
int all = 1;

inline int copy_past (int v) {
    t[all] = t[v];
    return all++;
}

inline void build (int v, int tl, int tr) {
    if (tl == tr) {
        return;
    }
    int tm = (tl + tr) >> 1;
    t[v].l = all++;
    build(t[v].l, tl, tm);
    t[v].r = all++;
    build(t[v].r, tm + 1, tr);
}

const int max_N = 1e6 + 11;

num h[max_N] = {};



inline void upd (int v, int tl, int tr, int pos, int x) {
    ++t[v].cnt;
    t[v].h = t[v].h * h[x];
    if (tl == tr) {
        return;
    }
    int tm = (tl + tr) >> 1;
    if (pos <= tm) {
        t[v].l = copy_past(t[v].l);
        upd(t[v].l, tl, tm, pos, x);
    }
    else {
        t[v].r = copy_past(t[v].r);
        upd(t[v].r, tm + 1, tr, pos, x);
    }
}

int n;


inline bool cmp (int v1, int v2, int tl, int tr) {
    LOG(tl, tr, t[v1].h.a, t[v2].h.a);
    if (tl == tr) {
        LOG(tr, t[v1].cnt, t[v2].cnt, v1, v2);
        return t[v1].cnt > t[v2].cnt;
    }
    int tm = (tl + tr) >> 1;
    if (t[t[v1].r].h == t[t[v2].r].h) {
        return cmp(t[v1].l, t[v2].l, tl, tm);
    }
    return cmp(t[v1].r, t[v2].r, tm + 1, tr);
}


struct min_st {
    int root;

    min_st(int x = -1) : root(x) {}


    bool operator < (const min_st &x) const {
        LOG(root, x.root);
        return cmp(root, x.root, 0, n - 1);
    }

    bool operator == (const min_st &x) const {
        return root == x.root;
    }

    inline void add (int x) {
        upd(root, 0, n - 1, x, x);
    }

    inline min_st copy () {
        return min_st(copy_past(root));
    }
};

struct min_queue {

    queue <min_st> q;
    deque <min_st> mn;

    inline void add (min_st x) {
        LOG("add");
        q.push(x);
        while (!mn.empty() && x < mn.back()) {
            LOG("here");
            mn.pop_back();
        }
        mn.pb(x);
    }

    inline void del () {
        if (mn.front() == q.front()) {
            mn.pop_front();
        }
        q.pop();
    }

    inline bool empty () {
        return q.empty();
    }

    inline min_st get_min () {
        return mn.front();
    }
};

mt19937 rng(228);
template<typename T = int>
inline T randll(T l = INT_MIN, T r = INT_MAX) {
    return uniform_int_distribution<T>(l, r)(rng);
}

inline ld randld(ld l = INT_MIN, ld r = INT_MAX) {
    return uniform_real_distribution<ld>(l, r)(rng);
}

vector <int> ans;

inline void go (int v, int tl, int tr) {
    if (tl == tr) {
        for (int i = 0; i < t[v].cnt; i++) {
            ans.pb(tr);
        }
        return;
    }
    int tm = (tl + tr) >> 1;
    go(t[v].l, tl, tm);
    go(t[v].r, tm + 1, tr);
}

inline void test_case () {
    ans.clear();
    while (all >= 0) {
        t[all].l = t[all].r = t[all].cnt = 0;
        t[all].h = 1;
        --all;
    }
    all = 1;
    int l, r;
    cin >> n >> l >> r;
    vector <int> x(n), a(n);
    for (auto &i : x) cin >> i;
    for (auto &i : a) {
        cin >> i;
        --i;
    }
    min_queue q;
    vector <min_st> b(n);
    b[0].root = 0;
    build(0, 0, n - 1);
    b[0].add(a[0]);
    for (int i = 1, j = 0, k = 0; i < n; i++) {
        LOG(i);
        while (x[i] - x[k] >= l) {
            if (b[k].root != -1) {
                q.add(b[k]);
            }
            ++k;
        }
        while (x[i] - x[j] > r) {
            if (b[j].root != -1) {
                q.del();
            }
            ++j;
        }
        if (!q.empty()) {
            LOG(q.get_min().root);
            b[i] = q.get_min().copy();
            LOG(i, b[i].root);
            b[i].add(a[i]);
        }
    }
    if (b[n - 1].root == -1) {
        cout << "-1\n";
        return;
    }
    go(b[n - 1].root, 0, n - 1);
//    sort(all(ans));
    reverse(all(ans));
    cout << len(ans) << '\n';
    for (auto &i : ans) {
        cout << i + 1 << ' ';
    }
    cout << '\n';
}

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    for (int i = 0; i < max_N; i++) {
        h[i].a = randll(1, num::MA - 1);
        h[i].b = randll(1, num::MB - 1);
    }

    int t = 1;
    cin >> t;
    for (int test = 1; test <= t; test++) {
        test_case();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 27ms
memory: 402004kb

input:

2
5 2 3
1 2 3 4 5
5 2 3 1 4
3 1 2
1 4 7
3 3 3

output:

3
5 4 3 
-1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 176ms
memory: 402096kb

input:

10000
57 8 11
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 47 48 49 50 51 52 53 54 55 56 57
11 16 7 7 10 13 9 14 10 1 12 4 8 13 3 20 16 7 16 19 20 8 19 7 16 6 17 13 7 19 17 11 12 17 6 3 7 8 14 2 4 15 5 18 16 7 20 9 1...

output:

7
20 20 19 14 12 11 3 
-1
6
6 5 3 2 1 1 
-1
185
20 20 20 20 20 20 20 20 19 19 19 19 19 19 19 19 19 19 19 19 18 18 18 18 18 17 17 17 17 17 17 17 17 16 16 16 16 16 16 16 16 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 ...

result:

ok 16378 lines

Test #3:

score: 0
Accepted
time: 154ms
memory: 402060kb

input:

10000
86 230405 991217
3291 11742 17120 30018 47955 52215 96227 98031 100118 106944 117304 121905 124796 135037 164100 164654 169459 177527 206513 212554 228740 229590 261521 295062 300116 312030 326533 329513 349983 353580 355242 356731 363347 368753 389545 396163 399755 409927 426532 427781 441386...

output:

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

result:

ok 14975 lines

Test #4:

score: 0
Accepted
time: 195ms
memory: 402048kb

input:

10000
101 17 17
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

-1
15
10 10 10 10 10 10 9 9 9 9 7 7 6 6 3 
-1
44
10 10 10 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 7 6 6 6 6 6 6 6 5 4 3 3 3 3 
11
10 10 10 10 10 9 8 7 6 6 2 
6
10 10 10 10 8 3 
18
10 10 10 10 10 10 8 8 8 8 7 7 7 6 5 3 2 2 
-1
-1
1
1 
-1
-1
-1
20
10 10 10 10 10 10 10 10 10 9 8 8...

result:

ok 16344 lines

Test #5:

score: 0
Accepted
time: 155ms
memory: 402076kb

input:

10000
18 16 16
1 2 3 4 5 6 7 8 10 11 12 13 14 16 17 18 19 20
2 2 2 1 2 1 1 2 2 2 2 1 2 2 1 2 1 1
403 3 7
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 ...

output:

-1
126
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
-1
-1
-1
1
1 
-1
-1
10
2 2 2 2 2 2 1 1 1...

result:

ok 16420 lines

Test #6:

score: 0
Accepted
time: 176ms
memory: 402128kb

input:

10000
251 1 1
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

251
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 16925 lines

Test #7:

score: 0
Accepted
time: 262ms
memory: 402660kb

input:

100
23882 222 481
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

102
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 19...

result:

ok 167 lines

Test #8:

score: 0
Accepted
time: 182ms
memory: 402288kb

input:

100
3789 29850 70419
774 1032 1649 1723 2194 3021 3114 3308 3344 3360 3688 3781 3967 4245 4878 4966 5099 5597 5617 5638 5645 5784 5871 6136 6158 6358 6483 6600 6766 6775 6800 6895 7119 7439 7485 7696 7734 8432 8493 8581 8627 9203 9576 9885 10062 10290 10454 10466 10537 10717 10861 11048 11484 11497 ...

output:

30
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 19 18 3 
-1
-1
-1
4
20 20 18 10 
-1
6
20 20 20 20 15 9 
-1
-1
5
20 20 20 18 4 
4
20 20 13 7 
-1
4
20 20 19 18 
-1
-1
-1
-1
2
16 8 
-1
3
20 20 6 
8
20 20 20 20 20 20 15 12 
-1
-1
-1
17
20 20 20 20 20 20 20 20 20 20 20...

result:

ok 139 lines

Test #9:

score: 0
Accepted
time: 239ms
memory: 402408kb

input:

100
181 1947 1967
17 23 47 53 55 68 84 92 110 147 153 164 191 198 207 209 215 221 255 269 275 302 305 322 324 363 370 373 385 405 407 429 451 458 466 472 478 500 508 544 557 561 564 565 569 587 600 610 617 630 645 659 665 670 674 715 726 744 747 764 769 770 774 782 786 787 794 795 824 852 860 873 87...

output:

-1
-1
-1
12
10 10 10 10 10 10 10 10 10 10 9 4 
12
10 10 10 10 10 10 10 10 10 10 5 5 
13
10 10 10 10 10 10 10 10 10 10 10 5 4 
-1
22
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 5 2 
215
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...

result:

ok 166 lines

Test #10:

score: 0
Accepted
time: 232ms
memory: 402244kb

input:

100
5589 851 904
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...

output:

-1
267
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

result:

ok 184 lines

Test #11:

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

input:

100
6944 1905 1926
2 3 4 6 7 8 9 10 11 13 15 16 17 18 20 22 23 24 25 29 31 32 33 34 35 39 40 42 43 44 45 46 47 49 51 54 55 57 58 60 61 62 63 64 67 68 69 71 72 74 75 76 78 79 80 81 82 83 84 85 86 90 91 92 94 95 96 98 100 104 105 106 107 108 109 111 112 117 118 119 120 123 125 126 127 128 131 133 134 ...

output:

-1
-1
296
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok 118 lines

Test #12:

score: 0
Accepted
time: 341ms
memory: 403724kb

input:

10
93999 762 838
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...

output:

124
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 
2332
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

result:

ok 20 lines

Test #13:

score: 0
Accepted
time: 257ms
memory: 408436kb

input:

10
10628 1687 1731
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97...

output:

-1
-1
76
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
-1
-1
219
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok 13 lines

Test #14:

score: 0
Accepted
time: 149ms
memory: 406440kb

input:

3
187063 95635158 95636093
11 507 618 934 1132 2191 3177 3365 3571 3605 4833 4988 5100 6157 6542 7005 7008 7258 7353 7366 7507 9327 10129 10131 10240 11168 11397 12964 13519 14429 14748 15782 16126 16244 16491 17464 17693 18411 19312 19807 19967 20183 21049 21170 21526 21813 22278 22946 23297 23600 ...

output:

-1
-1
-1

result:

ok 3 lines

Test #15:

score: 0
Accepted
time: 259ms
memory: 409200kb

input:

3
109970 343649 521308
4 6 25 27 32 45 53 56 76 81 100 111 115 133 143 145 163 169 173 174 194 199 243 261 299 300 303 311 332 335 341 357 367 368 374 387 392 412 415 422 435 437 442 443 444 454 458 462 466 478 482 486 490 497 499 505 512 521 528 544 549 558 560 574 587 597 620 622 625 643 651 652 6...

output:

3
2 2 1 
-1
8
2 2 2 2 2 2 1 1 

result:

ok 5 lines

Test #16:

score: 0
Accepted
time: 297ms
memory: 407980kb

input:

3
541782 286 289
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...

output:

1895
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

result:

ok 5 lines

Test #17:

score: 0
Accepted
time: 604ms
memory: 408632kb

input:

2
590573 45 48
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...

output:

12722
100000 100000 100000 100000 100000 100000 100000 99999 99999 99999 99999 99999 99999 99998 99998 99998 99998 99998 99998 99998 99998 99998 99998 99998 99998 99998 99998 99997 99997 99997 99997 99997 99996 99996 99996 99995 99995 99994 99994 99994 99994 99994 99994 99994 99993 99993 99993 99993...

result:

ok 4 lines

Test #18:

score: 0
Accepted
time: 402ms
memory: 409404kb

input:

2
658290 51 71
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...

output:

11109
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...

result:

ok 4 lines

Test #19:

score: -100
Runtime Error

input:

1
1000000 324190 960223
187 199 240 453 559 628 670 753 755 1329 1330 1681 1904 2042 2061 2169 2183 2233 2258 2535 2555 2711 2718 2819 2951 3211 3294 3309 3342 3456 3485 3491 3782 3834 3854 3968 4205 4236 4312 4314 4340 4371 4596 4603 4734 4792 5133 5249 5273 5469 5895 5915 5977 6006 6029 6062 6089 ...

output:


result: