CSES - Aalto Competitive Programming 2024 - wk4 - Mon - Results
Submission details
Task:Targeted advertising
Sender:AleksandrPolitov
Submission time:2024-09-23 17:13:41 +0300
Language:C++ (C++20)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails
#18ACCEPTED0.00 sdetails
#19ACCEPTED0.00 sdetails
#20ACCEPTED0.00 sdetails
#21ACCEPTED0.00 sdetails
#22ACCEPTED0.00 sdetails
#23ACCEPTED0.00 sdetails
#24ACCEPTED0.00 sdetails
#25ACCEPTED0.00 sdetails
#26ACCEPTED0.00 sdetails
#27ACCEPTED0.00 sdetails
#28ACCEPTED0.00 sdetails
#29ACCEPTED0.00 sdetails
#30ACCEPTED0.00 sdetails
#31ACCEPTED0.00 sdetails
#32ACCEPTED0.00 sdetails
#33ACCEPTED0.00 sdetails
#34ACCEPTED0.00 sdetails
#35ACCEPTED0.00 sdetails
#36ACCEPTED0.00 sdetails
#37ACCEPTED0.00 sdetails
#38ACCEPTED0.00 sdetails
#39ACCEPTED0.00 sdetails
#40ACCEPTED0.00 sdetails
#41ACCEPTED0.00 sdetails
#42ACCEPTED0.00 sdetails
#43ACCEPTED0.00 sdetails
#44ACCEPTED0.01 sdetails
#45ACCEPTED0.00 sdetails
#46ACCEPTED0.01 sdetails
#47ACCEPTED0.00 sdetails
#48ACCEPTED0.01 sdetails
#49ACCEPTED0.00 sdetails
#50ACCEPTED0.01 sdetails
#51ACCEPTED0.01 sdetails
#52ACCEPTED0.01 sdetails
#53ACCEPTED0.01 sdetails
#54ACCEPTED0.01 sdetails
#55ACCEPTED0.01 sdetails
#56ACCEPTED0.01 sdetails
#57ACCEPTED0.01 sdetails
#58ACCEPTED0.01 sdetails
#59ACCEPTED0.01 sdetails
#60ACCEPTED0.27 sdetails
#61ACCEPTED0.28 sdetails
#62ACCEPTED0.24 sdetails
#63ACCEPTED0.23 sdetails
#64ACCEPTED0.28 sdetails
#65ACCEPTED0.23 sdetails
#66ACCEPTED0.28 sdetails
#67ACCEPTED0.24 sdetails
#68ACCEPTED0.21 sdetails
#69ACCEPTED0.26 sdetails
#70ACCEPTED0.18 sdetails

Compiler report

input/code.cpp: In function 'int solve()':
input/code.cpp:174:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  174 |     for (int i = 1; i < tmp.size(); i++) {
      |                     ~~^~~~~~~~~~~~
input/code.cpp:207:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  207 |     for (int i = 0; i < res.size(); i++) {
      |                     ~~^~~~~~~~~~~~

Code

#ifdef ONPC
    #define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

#define char unsigned char
#define rep(i, a, b) for(int i=a; i< (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back

#define LSOne(S) ((S) & -(S))

using namespace std;
// mt19937 rnd(239);
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

typedef long long C;
typedef complex<C> P;
#define X real()
#define Y imag()

template<class T>
istream& operator>> (istream& is, complex<T>& p) {
    T value;
    is >> value;
    p.real(value);
    is >> value;
    p.imag(value);
    return is;
}

typedef long long ll;
typedef long double ld;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }

#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)))

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl;
#else
#define dbg(x...)
#endif

template<typename S, typename T = S> void chmin(S &s, T t) {s = s < t ? s : t;}
template<typename S, typename T = S> void chmax(S &s, T t) {s = s > t ? s : t;}

const int INF = 1e9; // 10^9 = 1B is < 2^31-1
const ll LLINF = 4e18; // 4*10^18 is < 2^63-1
const double EPS = 1e-9;
const ll MOD = 1e9+7;


struct Fenwick {
    vector<ll> tree;
    int n;

    Fenwick(int n) : n(n) {
        tree.assign(n, 0);
    }

    void point_add(int pos, ll val) {
        for (; pos < n; pos |= (pos + 1)) {
            tree[pos] += val;
        }
    }

    ll find_sum(int r) { // [0, r]
        ll ans = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1) {
            ans += tree[r];
        }
        return ans;
    }

    ll find_sum(int l, int r) { // [l, r)
        return find_sum(r - 1) - find_sum(l - 1);
    }
};

int solve() {
    int n, k, q; std::cin >> n >> k >> q;
    vector<int> v(n);
    std::map<int, vector<int>> mp;
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
        mp[v[i]].pb(i);
    }

    if(false)
    for(auto &w:mp) {
        std::cout << w.fi << ": ";
        __print(w.se); std::cout  << std::endl;
    }
    vector<pair<array<int, 3>, int>> Q;
    for (int i = 0; i < q; i++) {
        int l, r, x; std::cin >> l >> r >> x;
        Q.pb({{l, r, x}, i});
    }

    sort(Q.begin(), Q.end(), [&](auto &a, auto &b) {
        return a.fi[2]<b.fi[2];
    });

    //std::cout << Q.size() << std::endl;
    for (int i = 0; i < q; i++) {
        //__print(Q[i].fi); std::cout  << std::endl;
    }

    vector<int> tmp;
    tmp.pb(0);
    for (int i = 1; i < q; i++) {
        if(Q[i].fi[2]!=Q[i-1].fi[2]) {
            tmp.pb(i);
        }
    }

    tmp.pb(q);

    vector<int> res(q);
    for (int i = 0; i < q; i++) {
        //__print(Q[i].fi); std::cout  << std::endl;
        //std::cout << "Q: " << Q[i].se << std::endl;
    }

    //return 0;
    //std::cout  << std::endl;
    //std::cout << "tmp: ";
    //__print(tmp); std::cout  << std::endl;


    //return 0;
    //return 0;
    int curr=0;
    Fenwick ft(n);
    for (int i = 1; i < tmp.size(); i++) {
        //std::cout << Q[tmp[i-1]].fi[2] << std::endl;
        int currK=Q[tmp[i-1]].fi[2];
        //std::cout << "K: " << currK << std::endl;
        //__print(mp[currK]); std::cout  << std::endl;
        for(auto &w:mp[currK]) {
            ft.point_add(w, 1);
        }


        //for (int i = 0; i < n; i++) {
            //std::cout << ft.find_sum(i, i+1) << " ";
        //}
        //std::cout  << std::endl;
        
        for (int j = curr; j < tmp[i]; j++) {
            //std::cout << "lol" << std::endl;
            //std::cout << Q[j].fi[0] << " " << Q[j].fi[1] << std::endl;
            ll ans=ft.find_sum(Q[j].fi[0]-1, Q[j].fi[1]);

            //__print(Q[j].fi); std::cout  << std::endl;
            //std::cout << "lol" << std::endl;
            //std::cout  << Q[j].se << std::endl;
            res[Q[j].se]=ans;
        }
        //std::cout  << std::endl;
        for(auto &w:mp[currK]) {
            ft.point_add(w, -1);
        }

        curr=tmp[i];
    }

    for (int i = 0; i < res.size(); i++) {
        std::cout << res[i] << endl;
    }



     

    
    return 0;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1;
    //cin >> TET;
    for (int i = 1; i <= TET; i++) {
        #ifdef ONPC
            cout << "TEST CASE#" << i << endl;
        #endif
        
        if (solve()) {
            break;
        }

        #ifdef ONPC
            cout << "__________________________" << endl;
        #endif
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}

Test details

Test 1

Verdict: ACCEPTED

input
1 1 1

1 1 1

correct output
1

user output
1

Test 2

Verdict: ACCEPTED

input
1 1 2

1 1 1
1 1 1

correct output
1
1

user output
1
1

Test 3

Verdict: ACCEPTED

input
2 1 2
1 1 
2 2 1
1 2 1

correct output
1
2

user output
1
2

Test 4

Verdict: ACCEPTED

input
2 2 5
2 1 
1 1 2
1 1 2
1 2 2
...

correct output
1
1
1
1
1

user output
1
1
1
1
1

Test 5

Verdict: ACCEPTED

input
3 2 4
1 1 1 
1 3 1
2 3 2
2 2 2
...

correct output
3
0
0
0

user output
3
0
0
0

Test 6

Verdict: ACCEPTED

input
3 3 8
2 3 1 
2 3 2
1 2 2
2 3 1
...

correct output
0
1
1
1
1
...

user output
0
1
1
1
1
...

Test 7

Verdict: ACCEPTED

input
4 2 9
2 2 1 2 
2 2 2
2 4 1
2 3 1
...

correct output
1
1
1
1
2
...

user output
1
1
1
1
2
...

Test 8

Verdict: ACCEPTED

input
4 3 11
3 3 2 2 
3 3 2
2 4 1
3 3 3
...

correct output
1
0
0
1
1
...

user output
1
0
0
1
1
...

Test 9

Verdict: ACCEPTED

input
4 4 8
4 1 4 2 
3 4 2
2 2 1
1 4 2
...

correct output
1
1
1
1
1
...

user output
1
1
1
1
1
...

Test 10

Verdict: ACCEPTED

input
5 3 11
3 3 2 3 2 
3 5 2
2 4 2
2 5 1
...

correct output
2
1
0
2
1
...

user output
2
1
0
2
1
...

Test 11

Verdict: ACCEPTED

input
5 5 9
4 5 1 1 2 
1 5 2
1 2 1
2 2 4
...

correct output
1
0
0
0
1
...

user output
1
0
0
0
1
...

Test 12

Verdict: ACCEPTED

input
5 1 9
1 1 1 1 1 
3 3 1
1 2 1
4 4 1
...

correct output
1
2
1
2
1
...

user output
1
2
1
2
1
...

Test 13

Verdict: ACCEPTED

input
5 1 11
1 1 1 1 1 
3 5 1
1 5 1
1 2 1
...

correct output
3
5
2
1
4
...

user output
3
5
2
1
4
...

Test 14

Verdict: ACCEPTED

input
5 5 15
3 1 5 5 4 
4 4 3
1 2 5
1 2 4
...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...

Test 15

Verdict: ACCEPTED

input
5 1 7
1 1 1 1 1 
3 5 1
2 4 1
2 3 1
...

correct output
3
3
2
4
5
...

user output
3
3
2
4
5
...

Test 16

Verdict: ACCEPTED

input
5 5 14
2 2 5 1 1 
1 2 5
1 3 3
3 4 3
...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...

Test 17

Verdict: ACCEPTED

input
5 2 5
2 1 1 2 2 
3 5 1
2 3 2
1 1 1
...

correct output
1
0
0
1
1

user output
1
0
0
1
1

Test 18

Verdict: ACCEPTED

input
5 1 14
1 1 1 1 1 
2 5 1
1 4 1
3 4 1
...

correct output
4
4
2
3
3
...

user output
4
4
2
3
3
...

Test 19

Verdict: ACCEPTED

input
5 2 5
2 1 1 1 1 
1 2 1
2 5 1
1 2 1
...

correct output
1
4
1
1
2

user output
1
4
1
1
2

Test 20

Verdict: ACCEPTED

input
10 6 21
5 6 4 6 4 6 3 4 4 3 
3 5 6
1 10 2
4 5 5
...

correct output
1
0
0
1
2
...

user output
1
0
0
1
2
...

Test 21

Verdict: ACCEPTED

input
10 10 18
8 10 1 2 4 10 2 3 1 4 
2 4 4
4 7 10
6 9 5
...

correct output
0
1
0
0
0
...

user output
0
1
0
0
0
...

Test 22

Verdict: ACCEPTED

input
10 2 19
1 2 2 2 1 1 1 1 1 1 
3 7 2
2 3 1
3 7 2
...

correct output
2
0
2
0
3
...

user output
2
0
2
0
3
...

Test 23

Verdict: ACCEPTED

input
10 1 21
1 1 1 1 1 1 1 1 1 1 
1 2 1
1 3 1
5 7 1
...

correct output
2
3
3
4
5
...

user output
2
3
3
4
5
...

Test 24

Verdict: ACCEPTED

input
10 10 30
6 2 10 9 8 7 7 6 3 2 
3 10 1
3 7 10
5 7 8
...

correct output
0
1
1
1
0
...

user output
0
1
1
1
0
...

Test 25

Verdict: ACCEPTED

input
10 1 14
1 1 1 1 1 1 1 1 1 1 
4 8 1
3 5 1
2 9 1
...

correct output
5
3
8
2
3
...

user output
5
3
8
2
3
...

Test 26

Verdict: ACCEPTED

input
10 10 28
4 3 9 1 1 4 2 10 6 1 
6 7 5
4 6 5
7 9 5
...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...

Test 27

Verdict: ACCEPTED

input
10 3 11
3 1 2 3 3 2 3 1 2 1 
1 6 1
3 5 1
5 6 3
...

correct output
1
0
1
0
0
...

user output
1
0
1
0
0
...

Test 28

Verdict: ACCEPTED

input
10 1 28
1 1 1 1 1 1 1 1 1 1 
5 8 1
5 6 1
5 10 1
...

correct output
4
2
6
5
4
...

user output
4
2
6
5
4
...

Test 29

Verdict: ACCEPTED

input
10 4 10
3 2 2 1 1 2 1 1 1 4 
2 5 1
1 2 2
4 5 1
...

correct output
2
1
2
1
2
...

user output
2
1
2
1
2
...

Test 30

Verdict: ACCEPTED

input
100 60 210
43 51 37 52 33 51 26 38 39 24 ...

correct output
0
1
0
1
0
...

user output
0
1
0
1
0
...
Truncated

Test 31

Verdict: ACCEPTED

input
100 100 183
73 94 1 13 31 100 15 24 10 40 ...

correct output
0
1
1
0
0
...

user output
0
1
1
0
0
...
Truncated

Test 32

Verdict: ACCEPTED

input
100 19 187
1 18 11 19 9 10 8 7 7 3 4 14 1...

correct output
5
0
0
3
4
...

user output
5
0
0
3
4
...
Truncated

Test 33

Verdict: ACCEPTED

input
100 8 210
6 7 3 1 5 5 8 4 8 1 2 1 2 2 1 ...

correct output
0
9
0
3
4
...

user output
0
9
0
3
4
...
Truncated

Test 34

Verdict: ACCEPTED

input
100 91 294
50 16 89 78 66 56 64 55 20 13 ...

correct output
1
0
0
0
0
...

user output
1
0
0
0
0
...
Truncated

Test 35

Verdict: ACCEPTED

input
100 6 144
6 5 2 3 6 6 3 1 4 3 5 3 4 3 2 ...

correct output
7
15
10
15
5
...

user output
7
15
10
15
5
...
Truncated

Test 36

Verdict: ACCEPTED

input
100 95 279
32 20 79 7 4 36 11 94 57 10 51...

correct output
0
2
1
1
0
...

user output
0
2
1
1
0
...
Truncated

Test 37

Verdict: ACCEPTED

input
100 23 115
18 8 11 23 17 11 23 8 13 7 12 ...

correct output
1
0
0
4
0
...

user output
1
0
0
4
0
...
Truncated

Test 38

Verdict: ACCEPTED

input
100 2 275
2 1 2 1 2 2 1 1 1 2 1 2 1 1 2 ...

correct output
26
30
13
11
16
...

user output
26
30
13
11
16
...
Truncated

Test 39

Verdict: ACCEPTED

input
100 37 102
19 19 19 1 5 12 6 1 9 33 16 6 ...

correct output
1
1
3
2
1
...

user output
1
1
3
2
1
...
Truncated

Test 40

Verdict: ACCEPTED

input
200 119 420
86 101 72 103 65 101 51 75 77 ...

correct output
1
0
0
0
0
...

user output
1
0
0
0
0
...
Truncated

Test 41

Verdict: ACCEPTED

input
200 200 367
145 187 1 26 61 200 30 48 19 8...

correct output
0
0
2
0
0
...

user output
0
0
2
0
0
...
Truncated

Test 42

Verdict: ACCEPTED

input
200 38 374
1 36 21 37 17 19 16 13 13 6 8 ...

correct output
1
1
3
3
0
...

user output
1
1
3
3
0
...
Truncated

Test 43

Verdict: ACCEPTED

input
200 15 420
11 13 5 2 8 9 14 7 14 1 2 1 4 ...

correct output
6
0
11
2
3
...

user output
6
0
11
2
3
...
Truncated

Test 44

Verdict: ACCEPTED

input
200 181 587
100 32 177 155 130 111 127 109...

correct output
0
1
2
1
0
...

user output
0
1
2
1
0
...
Truncated

Test 45

Verdict: ACCEPTED

input
200 12 289
11 10 3 5 12 12 6 2 8 5 10 5 7...

correct output
2
13
0
3
6
...

user output
2
13
0
3
6
...
Truncated

Test 46

Verdict: ACCEPTED

input
200 190 558
64 40 157 13 8 71 21 188 114 1...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...
Truncated

Test 47

Verdict: ACCEPTED

input
200 46 230
36 15 21 45 34 21 45 15 25 13 ...

correct output
0
0
0
4
1
...

user output
0
0
0
4
1
...
Truncated

Test 48

Verdict: ACCEPTED

input
200 3 550
3 1 3 2 2 3 1 2 1 2 2 3 2 2 2 ...

correct output
38
59
26
36
10
...

user output
38
59
26
36
10
...
Truncated

Test 49

Verdict: ACCEPTED

input
200 73 204
37 37 37 1 10 24 11 1 16 65 31...

correct output
2
3
0
4
0
...

user output
2
3
0
4
0
...
Truncated

Test 50

Verdict: ACCEPTED

input
1000 593 2098
425 501 358 509 324 503 252 37...

correct output
1
0
0
0
4
...

user output
1
0
0
0
4
...
Truncated

Test 51

Verdict: ACCEPTED

input
1000 998 1834
719 931 1 128 302 998 147 236 ...

correct output
0
0
0
0
0
...

user output
0
0
0
0
0
...
Truncated

Test 52

Verdict: ACCEPTED

input
1000 186 1872
5 174 103 177 81 91 79 60 62 2...

correct output
0
0
1
3
0
...

user output
0
0
1
3
0
...
Truncated

Test 53

Verdict: ACCEPTED

input
1000 71 2102
51 60 21 9 37 41 64 32 64 2 9 ...

correct output
1
1
3
15
4
...

user output
1
1
3
15
4
...
Truncated

Test 54

Verdict: ACCEPTED

input
1000 901 2935
494 156 877 771 645 549 629 53...

correct output
0
0
1
1
0
...

user output
0
0
1
1
0
...
Truncated

Test 55

Verdict: ACCEPTED

input
1000 56 1444
49 47 12 21 52 55 28 6 35 23 4...

correct output
11
11
1
0
2
...

user output
11
11
1
0
2
...
Truncated

Test 56

Verdict: ACCEPTED

input
1000 948 2786
315 199 779 61 40 351 103 934 ...

correct output
1
0
1
0
0
...

user output
1
0
1
0
0
...
Truncated

Test 57

Verdict: ACCEPTED

input
1000 228 1152
178 73 100 224 165 104 223 71 ...

correct output
1
1
2
3
0
...

user output
1
1
2
3
0
...
Truncated

Test 58

Verdict: ACCEPTED

input
1000 12 2747
12 3 11 5 7 10 3 6 1 8 6 10 5 ...

correct output
0
25
15
7
47
...

user output
0
25
15
7
47
...
Truncated

Test 59

Verdict: ACCEPTED

input
1000 365 1020
184 183 181 3 49 116 52 5 80 3...

correct output
1
0
0
1
0
...

user output
1
0
0
1
0
...
Truncated

Test 60

Verdict: ACCEPTED

input
100000 59286 100000
42402 50054 35736 50865 32305 ...

correct output
1
0
3
1
1
...

user output
1
0
3
1
1
...
Truncated

Test 61

Verdict: ACCEPTED

input
100000 99721 100000
71833 92998 12 12777 30150 996...

correct output
1
0
0
0
0
...

user output
1
0
0
0
0
...
Truncated

Test 62

Verdict: ACCEPTED

input
100000 18509 100000
480 17242 10174 17542 8058 897...

correct output
0
2
1
1
1
...

user output
0
2
1
1
1
...
Truncated

Test 63

Verdict: ACCEPTED

input
100000 7073 100000
5009 5941 2058 859 3614 4027 6...

correct output
6
9
3
2
0
...

user output
6
9
3
2
0
...
Truncated

Test 64

Verdict: ACCEPTED

input
100000 90064 100000
49287 15554 87606 77063 64381 ...

correct output
1
2
0
0
0
...

user output
1
2
0
0
0
...
Truncated

Test 65

Verdict: ACCEPTED

input
100000 5519 100000
4806 4589 1141 2008 5070 5406 ...

correct output
10
1
9
14
0
...

user output
10
1
9
14
0
...
Truncated

Test 66

Verdict: ACCEPTED

input
100000 94750 100000
31456 19842 77813 6089 3951 35...

correct output
0
1
0
1
0
...

user output
0
1
0
1
0
...
Truncated

Test 67

Verdict: ACCEPTED

input
100000 22735 100000
17732 7252 9968 22240 16449 10...

correct output
0
4
0
1
1
...

user output
0
4
0
1
1
...
Truncated

Test 68

Verdict: ACCEPTED

input
100000 1112 100000
1078 267 967 420 591 908 259 4...

correct output
7
13
73
12
23
...

user output
7
13
73
12
23
...
Truncated

Test 69

Verdict: ACCEPTED

input
100000 36447 100000
18292 18192 18070 275 4878 115...

correct output
0
1
1
2
2
...

user output
0
1
1
2
2
...
Truncated

Test 70

Verdict: ACCEPTED

input
100000 100000 100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
100000
100000
100000
100000
100000
...

user output
100000
100000
100000
100000
100000
...
Truncated