QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#829208#9557. Temperanceucup-team4435#AC ✓311ms19400kbC++2311.3kb2024-12-24 07:04:382024-12-24 07:04:38

Judging History

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

  • [2024-12-24 07:04:38]
  • 评测
  • 测评结果:AC
  • 用时:311ms
  • 内存:19400kb
  • [2024-12-24 07:04:38]
  • 提交

answer

#include "bits/stdc++.h"


#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define each(x, a) for (auto &x : a)
#define ar array
#define vec vector
#define range(i, n) rep(i, n)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;

using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pair<int, int>>;
using vvi = vector<vi>;

int Bit(int mask, int b) { return (mask >> b) & 1; }

template<class T>
bool ckmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool ckmax(T &a, const T &b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

// [l, r)
template<typename T, typename F>
T FindFirstTrue(T l, T r, const F &predicat) {
    --l;
    while (r - l > 1) {
        T mid = l + (r - l) / 2;
        if (predicat(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }
    return r;
}


template<typename T, typename F>
T FindLastFalse(T l, T r, const F &predicat) {
    return FindFirstTrue(l, r, predicat) - 1;
}

const int INFi = 2e9;
const ll INF = 2e18;

/*
 ! WARNING: MOD must be prime if you use division or .inv().
 ! WARNING: 2 * (MOD - 1) must be smaller than INT_MAX
 * Use .value to get the stored value.
 */
template<typename T>
int normalize(T value, int mod) {
    if (value < -mod || value >= 2 * mod) value %= mod;
    if (value < 0) value += mod;
    if (value >= mod) value -= mod;
    return value;
}

template<int mod>
struct static_modular_int {
    static_assert(mod - 2 <= std::numeric_limits<int>::max() - mod, "2(mod - 1) <= INT_MAX");
    using mint = static_modular_int<mod>;

    int value;

    static_modular_int() : value(0) {}
    static_modular_int(const mint &x) : value(x.value) {}

    template<typename T, typename U = std::enable_if_t<std::is_integral<T>::value>>
    static_modular_int(T value) : value(normalize(value, mod)) {}

    static constexpr int get_mod() {
        return mod;
    }

    template<typename T>
    mint power(T degree) const {
        mint prod = 1, a = *this;
        for (; degree > 0; degree >>= 1, a *= a)
            if (degree & 1)
                prod *= a;

        return prod;
    }

    mint inv() const {
        return power(mod - 2);
    }

    mint& operator=(const mint &x) {
        value = x.value;
        return *this;
    }

    mint& operator+=(const mint &x) {
        value += x.value;
        if (value >= mod) value -= mod;
        return *this;
    }

    mint& operator-=(const mint &x) {
        value -= x.value;
        if (value < 0) value += mod;
        return *this;
    }

    mint& operator*=(const mint &x) {
        value = int64_t(value) * x.value % mod;
        return *this;
    }

    mint& operator/=(const mint &x) {
        return *this *= x.inv();
    }

    friend mint operator+(const mint &x, const mint &y) {
        return mint(x) += y;
    }

    friend mint operator-(const mint &x, const mint &y) {
        return mint(x) -= y;
    }

    friend mint operator*(const mint &x, const mint &y) {
        return mint(x) *= y;
    }

    friend mint operator/(const mint &x, const mint &y) {
        return mint(x) /= y;
    }

    mint& operator++() {
        ++value;
        if (value == mod) value = 0;
        return *this;
    }

    mint& operator--() {
        --value;
        if (value == -1) value = mod - 1;
        return *this;
    }

    mint operator++(int) {
        mint prev = *this;
        value++;
        if (value == mod) value = 0;
        return prev;
    }

    mint operator--(int) {
        mint prev = *this;
        value--;
        if (value == -1) value = mod - 1;
        return prev;
    }

    mint operator-() const {
        return mint(0) - *this;
    }

    bool operator==(const mint &x) const {
        return value == x.value;
    }

    bool operator!=(const mint &x) const {
        return value != x.value;
    }

    bool operator<(const mint &x) const {
        return value < x.value;
    }

    template<typename T>
    explicit operator T() {
        return value;
    }

    friend std::istream& operator>>(std::istream &in, mint &x) {
        std::string s;
        in >> s;
        x = 0;
        bool neg = s[0] == '-';
        for (const auto c : s)
            if (c != '-')
                x = x * 10 + (c - '0');

        if (neg)
            x *= -1;

        return in;
    }

    friend std::ostream& operator<<(std::ostream &out, const mint &x) {
        return out << x.value;
    }

    static int primitive_root() {
        if constexpr (mod == 1'000'000'007)
            return 5;
        if constexpr (mod == 998'244'353)
            return 3;
        if constexpr (mod == 786433)
            return 10;

        static int root = -1;
        if (root != -1)
            return root;

        std::vector<int> primes;
        int value = mod - 1;
        for (int i = 2; i * i <= value; i++)
            if (value % i == 0) {
                primes.push_back(i);
                while (value % i == 0)
                    value /= i;
            }

        if (value != 1)
            primes.push_back(value);

        for (int r = 2;; r++) {
            bool ok = true;
            for (auto p : primes)
                if ((mint(r).power((mod - 1) / p)).value == 1) {
                    ok = false;
                    break;
                }

            if (ok)
                return root = r;
        }
    }
};

// constexpr int MOD = 1'000'000'007;
 constexpr int MOD = 998'244'353;
using mint = static_modular_int<MOD>;

/*
 ! WARNING: MOD must be prime.
 * Define modular int class above it.
 * No need to run any init function, it dynamically resizes the data.
 */
namespace combinatorics {
    std::vector<mint> fact_, ifact_, inv_;

    void resize_data(int size) {
        if (fact_.empty()) {
            fact_ = {mint(1), mint(1)};
            ifact_ = {mint(1), mint(1)};
            inv_ = {mint(0), mint(1)};
        }
        for (int pos = fact_.size(); pos <= size; pos++) {
            fact_.push_back(fact_.back() * mint(pos));
            inv_.push_back(-inv_[MOD % pos] * mint(MOD / pos));
            ifact_.push_back(ifact_.back() * inv_[pos]);
        }
    }

    struct combinatorics_info {
        std::vector<mint> &data;

        combinatorics_info(std::vector<mint> &data) : data(data) {}

        mint operator[](int pos) {
            if (pos >= static_cast<int>(data.size())) {
                resize_data(pos);
            }
            return data[pos];
        }
    } fact(fact_), ifact(ifact_), inv(inv_);

    // From n choose k.
    // O(max(n)) in total.
    mint choose(int n, int k) {
        if (n < k || k < 0 || n < 0) {
            return mint(0);
        }
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // From n choose k.
    // O(min(k, n - k)).
    mint choose_slow(int64_t n, int64_t k) {
        if (n < k || k < 0 || n < 0) {
            return mint(0);
        }
        k = std::min(k, n - k);
        mint result = 1;
        for (int i = k; i >= 1; i--) {
            result *= (n - i + 1);
            result *= inv[i];
        }
        return result;
    }

    // Number of balanced bracket sequences with n open and m closing brackets.
    mint catalan(int n, int m) {
        if (m > n || m < 0) {
            return mint(0);
        }
        return choose(n + m, m) - choose(n + m, m - 1);
    }

    // Number of balanced bracket sequences with n open and closing brackets.
    mint catalan(int n) {
        return catalan(n, n);
    }
} // namespace combinatorics

using namespace combinatorics;


namespace ext_combinatorics {
    // distribute n equal elements into k groups
    mint distribute(int n, int k) {
        return choose(n + k - 1, n);
    }

    // count number of seqs with n '(' and m ')' and bal always >= 0
    mint catalan_nm(int n, int m) {
        assert(n >= m);
        return choose(m + n, m) - choose(m + n, m - 1);
    }

    mint catalan(int n) {
        return catalan_nm(n, n);
    }

    // count number of bracket seqs, bal always >= 0
    mint catalan_bal(int n, int start_balance = 0, int end_balance = 0) {
        if ((n + start_balance + end_balance) % 2 != 0) return 0;
        if (start_balance < 0 || end_balance < 0) return 0;
        return choose(n, (n + end_balance - start_balance) / 2) - choose(n, (n - end_balance - start_balance - 2) / 2);
    }

    // from (0, 0) to (x, y)
    mint grid_path(int x, int y) {
        return choose(x + y, x);
    }

    // from (0, 0) to (x, y) not touch low y=x+b
    mint grid_path_low(int x, int y, int b) {
        if (b >= 0) return 0;
        return grid_path(x, y) - grid_path(y - b, x + b);
    }

    // from (0, 0) to (x, y) not touch up y=x+b
    // O((x + y) / |b2 - b1|)
    mint grid_path_up(int x, int y, int b) {
        if (b <= 0) return 0;
        return grid_path(x, y) - grid_path(y - b, x + b);
    }

    // from (0, 0) to (x, y) touch L -LU +LUL -LULU ....
    // O((x + y) / |b2 - b1|)
    mint grid_calc_LUL(int x, int y, int b1, int b2) {
        swap(x, y);
        x -= b1;
        y += b1;
        if (x < 0 || y < 0) return 0;
        return grid_path(x, y) - grid_calc_LUL(y, x, -b2, -b1);
    }

    // from (0, 0) to (x, y) not touch low y=x+b1, up y=x+b2
    // O((x + y) / |b2 - b1|)
    mint grid_path_2(int x, int y, int b1, int b2) {
        return grid_path(x, y) - grid_calc_LUL(x, y, b1, b2) - grid_calc_LUL(y, x, -b2, -b1);
    }

    // probability what we end in L+R after infinity random walk, if we start at L, and absorbing points is 0, L+R.
    mint gambler_ruin_right(int L, int R, mint p_right) {
        assert(L >= 1 && R >= 1);
        if (p_right * 2 == 1) return mint(L) / mint(L + R);
        if (p_right == 1) return 1;
        if (p_right == 0) return 0;
        mint v = (1 - p_right) / p_right;
        return (1 - v.power(L)) / (1 - v.power(L + R));
    }

    mint gambler_ruin_left(int L, int R, mint p_left) {
        return 1 - gambler_ruin_right(L, R, 1 - p_left);
    }
} // namespace ext_combinatorics



void solve() {
    int n; cin >> n;
    vector<map<int, int>> cnt(3);
    vector<ar<int, 3>> a(n);
    rep(i, n)
    {
        rep(j, 3) {
            cin >> a[i][j];
            cnt[j][a[i][j]]++;
        }
    }
    vi ans(n + 1);
    rep(i, n) {
        int x = 0;
        rep(j, 3) ckmax(x, cnt[j][a[i][j]]);
        ans[x]++;
    }
    for(int i = n-1; i >= 0; --i) ans[i] += ans[i+1];
    rep(i, n) cout << n-ans[i+1] << ' ';
    cout << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(12) << fixed;
    int t = 1;
    cin >> t;
    rep(i, t) {
        solve();
    }
    return 0;
}

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

详细

Test #1:

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

input:

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

output:

0 0 2 5 5 
0 3 3 

result:

ok 8 numbers

Test #2:

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

input:

16
1
1 1 1
2
1 1 1
1 1 100000
3
1 1 1
1 1 100000
1 100000 1
4
1 1 1
1 1 100000
1 100000 1
1 100000 100000
5
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
6
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 1 100000
7
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 ...

output:

0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 0 7 7 7 
0 0 0 0 8 8 8 8 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 0 7 7 7 
0 0 0 0 8 8 8 8 

result:

ok 72 numbers

Test #3:

score: 0
Accepted
time: 53ms
memory: 3628kb

input:

10000
22
1 4 4
7 2 6
6 5 4
4 4 1
1 7 1
7 6 6
5 8 6
4 4 8
6 7 6
1 7 3
5 7 8
5 1 3
2 1 7
1 2 5
6 1 2
3 1 1
7 3 8
1 4 6
6 5 7
4 4 7
7 7 5
3 4 6
13
2 7 3
2 7 5
5 1 5
8 7 1
6 6 7
3 5 8
8 1 6
4 8 4
1 4 3
6 2 5
6 8 4
1 5 5
5 3 4
28
4 7 2
3 8 5
1 1 6
1 7 4
5 5 6
6 1 5
4 5 2
1 1 5
2 6 3
4 3 6
4 5 7
3 3 6
6 8...

output:

0 0 0 0 7 12 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 0 3 9 13 13 13 13 13 13 13 13 13 
0 0 0 0 8 21 21 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 
0 0 1 9 9 14 14 14 14 14 14 14 14 14 
0 0 0 6 9 12 12 19 19 19 19 19 19 19 19 19 19 19 19 
0 0 0 0 3 8 10 22 36 36 36 36 3...

result:

ok 199157 numbers

Test #4:

score: 0
Accepted
time: 73ms
memory: 3852kb

input:

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

output:

0 2 11 11 11 11 11 11 11 11 11 
0 0 2 11 22 33 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 
0 
0 3 12 15 15 15 15 15 15 15 15 15 15 15 15 
0 1 3 21 25 32 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 3...

result:

ok 199593 numbers

Test #5:

score: 0
Accepted
time: 83ms
memory: 3664kb

input:

10000
22
40126 51309 54005
77536 83774 68530
35537 89229 39298
26549 72686 40526
72054 78714 67371
54406 93387 54598
62891 79741 7031
21699 38166 16961
98001 73695 16118
23105 44313 87949
61147 44816 82830
40866 30839 37096
63254 98489 15491
2724 410 12208
96504 21764 35334
777 98615 64141
98638 282...

output:

0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 10 10 10 10 10 10 10 10 10 
0 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 
0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 2...

result:

ok 194828 numbers

Test #6:

score: 0
Accepted
time: 64ms
memory: 3632kb

input:

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

output:

0 3 7 8 8 13 13 13 13 13 13 13 13 
0 0 7 12 18 18 18 18 18 18 18 18 18 18 18 18 18 18 
0 0 5 6 17 17 17 17 17 17 17 17 17 17 17 17 17 
0 0 3 
0 1 5 5 5 
0 2 8 15 15 15 15 15 15 15 15 15 15 15 15 
0 1 6 9 9 9 9 9 9 
0 0 5 17 17 17 17 17 17 17 17 17 17 17 17 17 17 
0 1 5 5 5 
0 2 
0 
0 0 13 16 16 16 1...

result:

ok 191387 numbers

Test #7:

score: 0
Accepted
time: 79ms
memory: 3620kb

input:

20000
2
69026 89423 26470
19943 3587 25231
9
96641 23438 60068
67211 19770 48041
15125 93974 46480
5771 64091 75193
17303 53889 28772
24105 87959 20685
14225 35987 93612
79842 79992 89652
81542 34986 15554
15
7463 88448 20014
74043 61063 90326
80812 97411 13843
38384 61124 37764
18186 80264 55309
12...

output:

0 2 
0 9 9 9 9 9 9 9 9 
0 15 15 15 15 15 15 15 15 15 15 15 15 15 15 
0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 
0 7 7 7 7 7 7 
0 8 8 8 8 8 8 8 
0 13 13 13 13 13 13 13 13 13 13 13 13 
0 4 4 4 
0 3 3 
0 3 3 
0 5 5 5 5 
0 2 
0 2 
0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 
0 3 3 
0 13 13 13 13...

result:

ok 189019 numbers

Test #8:

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

input:

2
61322
15 48 50
13 48 35
41 1 39
4 4 46
13 46 39
48 43 8
37 28 42
47 6 18
15 27 25
11 34 45
33 28 9
33 37 15
40 16 26
13 10 22
10 41 17
21 22 8
37 31 48
11 48 29
1 45 49
26 28 3
35 20 36
17 42 40
42 45 36
49 32 28
46 37 5
35 50 49
30 36 32
17 35 11
38 49 27
25 7 21
41 7 3
25 48 9
4 17 13
12 30 23
3...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 64422 numbers

Test #9:

score: 0
Accepted
time: 235ms
memory: 12272kb

input:

2
82319
81784 15676 55428
36920 13434 44904
46877 92320 35269
44212 4490 14286
46939 25409 46324
66302 38351 14822
2554 1983 16106
23690 16816 73141
23210 66029 15099
93719 34782 576
22743 40722 70251
59272 25745 16644
50442 3167 5358
42914 48423 52435
546 35826 2467
42278 59162 52914
56020 16044 76...

output:

0 6924 42079 70072 79822 81906 82247 82310 82310 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319 82319...

result:

ok 130773 numbers

Test #10:

score: 0
Accepted
time: 311ms
memory: 19400kb

input:

2
100000
95821 95821 95821
54965 54965 54965
63811 63811 63811
11219 11219 11219
27274 27274 27274
76752 76752 76752
70949 70949 70949
59746 59746 59746
84495 84495 84495
60363 60363 60363
93707 93707 93707
91384 91384 91384
81227 81227 81227
13202 13202 13202
80413 80413 80413
67024 67024 67024
955...

output:

0 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 1000...

result:

ok 200000 numbers

Test #11:

score: 0
Accepted
time: 127ms
memory: 9860kb

input:

2
100000
95821 100000 100000
54965 100000 100000
63811 100000 100000
11219 100000 100000
27274 100000 100000
76752 100000 100000
70949 100000 100000
59746 100000 100000
84495 100000 100000
60363 100000 100000
93707 100000 100000
91384 100000 100000
81227 100000 100000
13202 100000 100000
80413 10000...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 200000 numbers

Test #12:

score: 0
Accepted
time: 102ms
memory: 7384kb

input:

2
100000
15607 10014 1
15607 9262 14
15607 9234 10
15607 8689 1
15607 9029 4
14951 6967 16
29294 6967 6
15607 7733 8
18137 6967 6
4732 6967 2
15607 3881 13
16779 6967 6
15607 8967 1
9472 6967 11
7513 6967 2
14262 6967 2
15607 10174 4
15607 14425 1
15607 11464 10
15607 7552 20
13620 6967 2
15117 6967...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 200000 numbers

Test #13:

score: 0
Accepted
time: 81ms
memory: 5520kb

input:

2
100000
2150 1762 156
2597 1769 155
2150 2164 41
2150 1645 200
2940 1769 232
2150 2357 244
2150 2542 211
2150 1602 200
3800 1769 68
1988 1769 35
2150 1476 291
1934 1769 161
2150 2330 129
2854 1769 121
2150 1741 156
2150 1832 37
2040 1769 271
1954 1769 53
2135 1769 220
2150 1993 43
2018 1769 144
215...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 200000 numbers

Test #14:

score: 0
Accepted
time: 118ms
memory: 7516kb

input:

2
100000
2 2 20043
2 1 46314
3 2 35997
2 2 187
3 2 2659
2 2 30453
2 3 35736
2 2 42562
2 2 45524
2 2 18450
2 2 46079
2 1 48534
2 2 9224
2 2 25209
1 2 26067
1 2 47241
2 1 38187
2 3 13413
2 3 5436
3 2 25393
2 1 16032
2 1 11613
2 1 13527
2 1 1691
2 2 11078
2 2 42812
2 2 15877
2 2 31491
2 3 42954
2 2 315...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 80ms
memory: 5188kb

input:

2
99235
437 669 437
189 213 189
404 634 404
327 608 327
243 342 243
122 128 122
431 582 431
433 839 433
302 414 302
375 648 375
419 758 419
53 83 53
291 476 291
157 259 157
326 609 326
199 237 199
192 278 192
430 786 430
223 420 223
233 393 233
349 478 349
414 432 414
82 101 82
118 191 118
236 412 2...

output:

0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 465 496 528 561 595 630 666 703 741 780 820 861 903 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 2556 262...

result:

ok 198470 numbers

Test #16:

score: 0
Accepted
time: 146ms
memory: 9880kb

input:

2
100000
80563 80563 97252
12843 12843 19316
12843 12843 16382
44624 44624 46497
60814 60814 63977
60814 60814 71202
30582 30582 32221
30582 30582 32531
60814 60814 75724
44624 44624 51465
30582 30582 35921
4002 4002 9752
12843 12843 15363
80563 80563 96382
60814 60814 63381
79534 76436 76436
60814 ...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 200000 numbers

Test #17:

score: 0
Accepted
time: 226ms
memory: 9908kb

input:

2
100000
87516 87516 87624
89008 89008 89031
23379 23457 23379
44799 44799 44841
57419 57419 57510
61889 61889 61996
4521 4482 4482
46081 46062 46062
51673 51399 51399
18489 18512 18489
92503 92625 92503
28615 28547 28547
39770 39770 39833
7066 7827 7066
27547 27496 27496
9503 9503 9520
58144 58192 ...

output:

0 7 23 44 76 141 177 268 332 440 550 649 805 870 968 1163 1419 1538 1736 1907 2087 2402 2578 2647 2719 2894 2998 3160 3328 3473 3563 3749 4101 4266 4538 4818 5034 5589 5893 6088 6368 6614 6908 7037 7301 7571 8031 8360 8696 9235 9535 9892 10308 10520 10952 11502 11950 12292 12350 12586 12766 12949 13...

result:

ok 200000 numbers

Test #18:

score: 0
Accepted
time: 121ms
memory: 12144kb

input:

2
100000
1 1 1
2 2 1
3 3 1
4 4 1
5 5 1
6 6 1
7 7 1
8 8 1
9 9 1
10 10 1
11 11 1
12 12 1
13 13 1
14 14 1
15 15 1
16 16 1
17 17 1
18 18 1
19 19 1
20 20 1
21 21 1
22 22 1
23 23 1
24 24 1
25 25 1
26 26 1
27 27 1
28 28 1
29 29 1
30 30 1
31 31 1
32 32 1
33 33 1
34 34 1
35 35 1
36 36 1
37 37 1
38 38 1
39 39...

output:

0 0 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50...

result:

ok 200000 numbers

Test #19:

score: 0
Accepted
time: 244ms
memory: 11076kb

input:

2
100000
82319 81784 15676
82319 55428 36920
82319 13434 44904
82319 46877 92320
82319 35269 44212
82319 4490 14286
82319 46939 25409
82319 46324 66302
82319 38351 14822
82319 2554 1983
82319 16106 23690
82319 16816 73141
82319 23210 66029
82319 15099 93719
82319 34782 576
82319 22743 40722
82319 70...

output:

0 0 0 0 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 200000 numbers

Extra Test:

score: 0
Extra Test Passed