QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623559#9424. Stop the Castle 2xorzjAC ✓376ms39104kbC++179.3kb2024-10-09 13:05:322024-10-09 13:05:32

Judging History

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

  • [2024-10-09 13:05:32]
  • 评测
  • 测评结果:AC
  • 用时:376ms
  • 内存:39104kb
  • [2024-10-09 13:05:32]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(a, b, c) for (int a = b; a <= c; a++)
#define ALL(x) (x).begin(), (x).end()
#define IOS cin.tie(0)->sync_with_stdio(false)
#ifdef LOCAL
#include "debug.h"
#else
#define deb(...) 42
#endif
#define OPENSTACK
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const int MAXN = 2e5 + 5;
const int INF = 0x3f3f3f3f;
namespace flow {
    const int N = 2e5 + 5, M = 3e5 + 5;
    struct edge {
        int next, to, w;
    } e[M << 1];
    int n, s, t;
    int head[N], cnt, cur[N], dis[N];
    void init(int n_, int s_, int t_)
    {
        s = s_, t = t_, n = n_, cnt = 0;
        for (int i = 0; i < n; i++) head[i] = -1;
    }
    void add_edge(int u, int v, int w)
    {
        e[cnt] = edge{ head[u], v, w };
        head[u] = cnt;
        cnt++;
        e[cnt] = edge{ head[v], u, 0 };
        head[v] = cnt;
        cnt++;
    }
    bool bfs()
    {
        for (int i = 0; i < n; i++) cur[i] = head[i], dis[i] = -1;
        queue<int> q;
        dis[s] = 0;
        q.push(s);
        while (!q.empty()) {
            int x = q.front();
            q.pop();
            for (int i = head[x]; ~i; i = e[i].next) {
                if (e[i].w) {
                    int y = e[i].to;
                    if (~dis[y]) continue;
                    dis[y] = dis[x] + 1;
                    q.push(y);
                }
            }
        }
        return ~dis[t];
    }
    int dfs(int x, int flow)
    {
        int ans = 0;
        if (x == t) return flow;
        for (int i = cur[x]; ~i; i = e[i].next, cur[x] = i) {
            int y = e[i].to, newflow = min(e[i].w, flow);
            if (dis[y] != dis[x] + 1 || !e[i].w) continue;
            newflow = dfs(y, newflow);
            e[i].w -= newflow;
            e[i ^ 1].w += newflow;
            flow -= newflow;
            ans += newflow;
            if (!flow) break;
        }
        return ans;
    }
    int dinic()
    {
        int ans = 0;
        while (bfs()) ans += dfs(s, numeric_limits<int>::max());
        return ans;
    }
    //返回S部点集,必须先跑完flow
    vector<bool> minCut()
    {
        vector<bool> c(n);
        for (int i = 0; i < n; i++) {
            c[i] = (dis[i] != -1);
        }
        return c;
    }
    //返回实际流量和上限流量
    struct Edge {
        int from;
        int to;
        int cap;
        int flow;
    };
    vector<Edge> edges()
    {
        vector<Edge> a;
        for (int i = 0; i < cnt; i += 2) {
            Edge x;
            x.from = e[i + 1].to;
            x.to = e[i].to;
            x.cap = e[i].w + e[i + 1].w;
            x.flow = e[i + 1].w;
            a.push_back(x);
        }
        return a;
    }
}  // namespace flow
using flow::add_edge;
using flow::dinic;
using flow::init;

ll seed = chrono::steady_clock::now().time_since_epoch().count();
mt19937_64 rnd(seed);
int Rnd(int l, int r)
{
    return rnd() % (r - l + 1) + l;
}

void solve()
{
    int debug = 0;
    while (true) {
        int n, m, k, V;
        if (debug)n = 10, m = 10, k = 5, V = 9;
        else cin >> n >> m >> k;
        vector<array<int, 2>>c(n);
        vector<array<int, 2>>blk(m);
        vector<int>tx, ty;
        set<pii>S;
        for (int i = 0; i < n; i++) {
            if (debug) {
                int x = Rnd(1, V), y = Rnd(1, V);
                while (S.count({ x,y }))x = Rnd(1, V), y = Rnd(1, V);
                S.insert({ x,y });
                c[i] = { x,y };
            }
            else {
                cin >> c[i][0] >> c[i][1];
            }
            tx.push_back(c[i][0]);
            ty.push_back(c[i][1]);
        }
        for (int i = 0; i < m; i++) {
            if (debug) {
                int x = Rnd(1, V), y = Rnd(1, V);
                while (S.count({ x,y }))x = Rnd(1, V), y = Rnd(1, V);
                S.insert({ x,y });
                blk[i] = { x,y };
            }
            else cin >> blk[i][0] >> blk[i][1];
            tx.push_back(blk[i][0]);
            ty.push_back(blk[i][1]);
        }

        sort(ALL(tx));
        tx.erase(unique(ALL(tx)), tx.end());
        sort(ALL(ty));
        ty.erase(unique(ALL(ty)), ty.end());

        for (auto& [x, y] : c) {
            x = lower_bound(ALL(tx), x) - tx.begin() + 1;
            y = lower_bound(ALL(ty), y) - ty.begin() + 1;
        }
        for (auto& [x, y] : blk) {
            x = lower_bound(ALL(tx), x) - tx.begin() + 1;
            y = lower_bound(ALL(ty), y) - ty.begin() + 1;
        }

        int N = tx.size(), M = ty.size();
        vector<set<int>>posx(N + 1), posy(M + 1);

        for (auto& [x, y] : c) {
            posx[x].insert(y);
            posy[y].insert(x);
        }
        deb(c, blk);

        int ans = 0;
        for (int x = 1; x <= N; x++) {
            int lst = -1;
            for (auto y : posx[x]) {
                if (lst != -1) {
                    ans++;
                }
                lst = y;
            }
        }
        for (int y = 1; y <= M; y++) {
            int lst = -1;
            for (auto x : posy[y]) {
                if (lst != -1) {
                    ans++;
                }
                lst = x;
            }
        }
        deb(ans);
        // cerr << ans << "\n";

        int cntx = 0, cnty = 0;
        map<array<int, 3>, int>idx, idy;
        vector<pair<array<int, 3>, array<int, 3>>>E(m);

        int s = 0, t = 2 * m + 1;
        init(t + 1, s, t);
        // deb(posy[2]);
        vector<int>ec(m, -1);
        for (int i = 0; i < m; i++) {
            int x = blk[i][0], y = blk[i][1];
            auto itx = posx[x].lower_bound(y);
            if (itx == posx[x].end() || itx == posx[x].begin()) { flow::cnt += 2; continue; }
            auto ity = posy[y].lower_bound(x);
            if (ity == posy[y].end() || ity == posy[y].begin()) { flow::cnt += 2; continue; }
            auto U = array<int, 3>{ *prev(itx), * itx, x };
            auto V = array<int, 3>{ *prev(ity), * ity, y };
            if (idx.emplace(U, cntx + 1).second)cntx++;
            if (idy.emplace(V, cnty + 1).second)cnty++;
            E[i] = { U,V };
            deb(U, V, i, flow::cnt, idx[U], idy[V]);
            ec[i] = flow::cnt;
            add_edge(idx[U], idy[V] + m, 1);
        }

        vector<int>del(m);
        int used = m - k;
        for (int i = 1; i <= cntx; i++)add_edge(s, i, 1);
        for (int i = 1; i <= cnty; i++)add_edge(i + m, t, 1);
        int g = dinic();
        auto Edge = flow::edges();
        set<array<int, 3>>deledx, deledy;
        // auto Del = [&](int x, int y) {
        //     deled.insert({ x,y });
        // };
        for (int i = 0; i < m; i++) {
            if (ec[i] == -1)continue;
            assert(ec[i] % 2 == 0);
            assert(ec[i] / 2 < m);
            auto e = Edge[ec[i] / 2];
            deb(e.flow, e.from, e.to);
            if (e.flow == 1) {
                if (used) {
                    used--;
                    ans -= 2;
                    auto [U, V] = E[ec[i] / 2];
                    deb(U, V);
                    del[i] = 1;
                    deledx.insert(U);
                    deledy.insert(V);
                }
            }
        }
        deb(ans, used);
        // cerr << ans << " " << used << "\n";
        if (used) {
            for (int i = 0; i < m; i++) {
                if (del[i] == 1 || used == 0)continue;
                auto [x, y] = blk[i];
                auto itx = posx[x].lower_bound(y);
                bool ok = 1;
                if (!(itx == posx[x].end() || itx == posx[x].begin()) && deledx.count({ *prev(itx),*itx,x }) == 0) {
                    deledx.insert({ *prev(itx),*itx,x });
                    ok = 0;
                    used--;
                    ans--;
                    del[i] = 1;
                }
                auto ity = posy[y].lower_bound(x);
                if (!(ity == posy[y].end() || ity == posy[y].begin()) && deledy.count({ *prev(ity),*ity,y }) == 0) {
                    deledy.insert({ *prev(ity),*ity,y });
                    used--;
                    ans--;
                    del[i] = 1;
                    // assert(ok == 1);
                }
            }
        }
        deb(ans, used);
        // cerr << used << "\n";
        // for (int i = 0; i < m; i++)cerr << del[i] << " \n"[i == m - 1];
        if (used) {
            for (int i = 0; i < m; i++) {
                if (del[i] == 0 && used) {
                    used--;
                    del[i] = 1;
                }
            }
        }
        // assert(count(ALL(del), 0) == k);
        cout << ans << "\n";
        for (int i = 0; i < m; i++)if (del[i] == 0)cout << i + 1 << " ";
        cout << "\n";
        if (!debug)break;
    }
}
int main()
{
#ifdef LOCAL
#ifdef OPENSTACK
    int size = 128 << 20; // 64MB
    char* p = (char*) malloc(size) + size;
#if (defined _WIN64) or (defined __unix)
    __asm__("movq %0, %%rsp\n" ::"r"(p));
#else
    __asm__("movl %0, %%esp\n" ::"r"(p));
#endif
#endif
#endif
    IOS;
    int _ = 1;
    cin >> _;
    while (_--) {
        solve();
    }
#ifdef LOCAL
#ifdef OPENSTACK
    exit(0);
#else
    return 0;
#endif
#endif
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5680kb

input:

3
8 6 4
1 3
2 1
2 6
4 1
4 7
6 1
6 3
6 6
2 3
3 1
4 3
4 6
5 2
6 4
3 2 1
10 12
10 10
10 11
1 4
1 5
1 3 2
1 1
2 1
2 2
2 3

output:

4
2 3 5 6 
2
2 
0
2 3 

result:

ok ok 3 cases (3 test cases)

Test #2:

score: 0
Accepted
time: 97ms
memory: 9700kb

input:

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

output:

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

result:

ok ok 1224 cases (1224 test cases)

Test #3:

score: 0
Accepted
time: 330ms
memory: 37940kb

input:

1
86289 95092 40401
911 152
1 270
135 731
347 451
283 224
338 348
166 346
12 385
590 763
939 176
232 405
122 946
397 576
795 823
546 392
33 718
444 598
954 852
185 662
732 539
172 681
386 148
76 495
163 323
711 201
278 363
531 275
66 122
823 983
234 792
102 188
985 423
804 712
419 636
318 331
693 68...

output:

81531
5791 5798 5799 5800 5801 5802 5803 5805 5806 5808 5809 5810 5811 5813 5814 5817 5824 5826 5827 5829 5831 5834 5835 5841 5846 5847 5848 5849 5851 5854 5862 5863 5864 5867 5868 5869 5872 5873 5874 5876 5878 5879 5883 5884 5885 5887 5889 5893 5894 5895 5897 5898 5899 5902 5911 5914 5917 5919 5920...

result:

ok ok 1 cases (1 test case)

Test #4:

score: 0
Accepted
time: 192ms
memory: 39104kb

input:

1
99057 99722 73893
190482185 274379837
466851670 641324039
993028302 128875937
102891466 286559847
526771097 794238060
565736409 328262657
190329865 598878250
790626887 595298790
308031819 470646878
341575785 374318107
257299536 280924175
64420619 591124604
323023069 811512407
428956686 719615923
2...

output:

82045
1 2 6 9 10 11 13 15 16 18 19 20 21 22 24 25 28 29 30 33 34 35 36 37 38 39 43 45 49 50 51 52 54 55 59 60 61 62 67 69 70 71 79 81 82 83 87 90 91 93 94 95 96 99 100 101 102 104 105 107 109 110 111 112 113 114 119 120 128 129 130 131 133 135 136 137 138 142 143 147 148 149 151 152 153 154 155 156 ...

result:

ok ok 1 cases (1 test case)

Test #5:

score: 0
Accepted
time: 376ms
memory: 37316kb

input:

1
100000 99990 27662
913840909 999962982
690565691 31053
780601566 31053
54745498 31053
5383 859704869
538124857 999962982
5383 66851413
1444277 31053
119603839 999962982
999833258 543197820
999833258 349576387
999833258 759855830
999833258 124692224
266093388 999962982
5383 100041707
999833258 2843...

output:

100891
60460 60462 60463 60464 60465 60466 60468 60470 60471 60472 60473 60475 60476 60477 60478 60479 60480 60482 60483 60485 60486 60487 60489 60490 60491 60492 60493 60496 60497 60498 60499 60500 60501 60502 60503 60504 60505 60507 60508 60510 60515 60516 60517 60518 60519 60520 60521 60522 60523...

result:

ok ok 1 cases (1 test case)

Test #6:

score: 0
Accepted
time: 351ms
memory: 33688kb

input:

1
100000 49997 21428
9380 4333
9380 999999628
49202 4333
49202 999999628
50841 4333
50841 999999628
77418 4333
77418 999999628
95722 4333
95722 999999628
144002 4333
144002 999999628
234359 4333
234359 999999628
268942 4333
268942 999999628
288956 4333
288956 999999628
415094 4333
415094 999999628
4...

output:

100000
7099 7100 7102 7103 7104 7105 7106 7108 7110 7113 7114 7117 7119 7120 7122 7123 7126 7130 7131 7134 7135 7136 7140 7145 7149 7151 7154 7157 7158 7160 7162 7163 7167 7170 7172 7173 7174 7176 7178 7182 7183 7184 7188 7190 7197 7199 7201 7204 7205 7206 7208 7209 7211 7212 7213 7215 7216 7221 722...

result:

ok ok 1 cases (1 test case)

Test #7:

score: 0
Accepted
time: 115ms
memory: 34932kb

input:

1
100000 100000 76259
931427170 7
367311884 7
646435086 7
925372747 7
371054451 7
284185575 7
695090232 7
889183241 7
615617158 7
44230096 7
293281406 7
758261641 7
685549291 7
679471071 7
723138327 7
901136691 7
49281635 7
256352978 7
320188290 7
78730802 7
788131872 7
234735044 7
664906524 7
79430...

output:

76258
463 577 797 819 881 890 900 923 993 1008 1061 1208 1267 1273 1283 1330 1357 1370 1381 1402 1438 1488 1493 1550 1556 1566 1614 1619 1655 1673 1721 1727 1758 1767 1804 1813 1829 1831 1844 1882 1906 1908 1914 1941 2020 2100 2193 2201 2209 2245 2284 2289 2303 2456 2466 2476 2484 2504 2537 2557 256...

result:

ok ok 1 cases (1 test case)

Test #8:

score: 0
Accepted
time: 82ms
memory: 31708kb

input:

1
100000 49999 24999
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

99996
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 99 100 10...

result:

ok ok 1 cases (1 test case)

Test #9:

score: 0
Accepted
time: 101ms
memory: 15932kb

input:

556
16 6 3
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
1 2
1000000000 2
1 3
1000000000 3
1 4
1000000000 4
1 5
1000000000 5
1 6
1000000000 6
2 3
3 3
3 2
4 2
2 4
4 4
32 12 6
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 ...

output:

14
2 4 5 
32
1 3 6 7 8 9 
31
3 5 6 7 8 11 14 16 
8
1 
13
2 4 
19
1 2 3 6 10 
11
2 3 4 
20
1 2 4 
15
3 4 6 7 
33
1 2 3 5 7 11 13 
31
1 2 3 5 8 10 14 15 
19
1 5 6 9 10 
31
1 3 4 7 8 
15
1 2 6 7 
28
4 6 7 8 10 
11
1 
19
2 3 5 7 10 
23
2 3 4 7 8 11 
34
2 3 4 5 6 8 9 15 
31
3 5 7 8 9 12 13 14 
29
2 4 5 6...

result:

ok ok 556 cases (556 test cases)

Test #10:

score: 0
Accepted
time: 348ms
memory: 33172kb

input:

1
100000 50000 25000
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

99996
1 4 5 7 8 10 11 14 15 18 19 20 22 25 28 30 33 34 36 38 39 41 43 45 46 47 48 51 54 55 56 57 60 61 63 64 65 68 78 82 85 88 89 90 91 94 97 102 103 104 109 111 113 114 115 117 118 119 121 122 124 129 130 132 135 137 138 141 143 145 146 147 148 149 151 152 153 155 156 157 158 159 160 162 164 165 17...

result:

ok ok 1 cases (1 test case)

Test #11:

score: 0
Accepted
time: 106ms
memory: 16236kb

input:

556
32 15 7
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
1 2
1000000000 2
1 3
1000000000 3
1 4
1000000000 4
1 5
1000000000 5
1 6
1000000000 6
1 7
1000000000 7
1 8
1000000000 8
1 9
1000000000 9
7 6
4 3
5 4
2 2
...

output:

28
1 2 3 7 8 10 15 
11
1 4 
20
3 4 
23
4 7 8 9 10 
26
1 2 6 7 8 
17
1 
10
2 
31
2 3 6 8 
14
1 
31
2 3 4 5 7 11 14 
34
2 3 4 5 7 8 15 
16
3 
32
1 2 6 7 8 
29
3 5 
28
1 6 7 8 10 12 15 
31
1 2 4 5 6 8 14 
25
3 5 8 9 
15
2 4 5 
29
1 5 6 9 11 
31
1 4 7 8 
15
1 2 7 
29
1 3 
27
1 3 6 
19
5 6 7 9 
25
1 6 7 ...

result:

ok ok 556 cases (556 test cases)

Test #12:

score: 0
Accepted
time: 344ms
memory: 35192kb

input:

1
100000 49999 24999
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

99996
1 3 4 6 8 10 12 17 20 22 25 26 27 29 30 32 33 34 35 37 39 42 44 47 48 49 51 54 58 59 60 61 68 69 70 72 74 75 77 78 81 82 84 85 88 89 90 91 93 94 96 97 98 100 103 110 111 112 114 115 116 120 123 124 127 129 130 133 135 136 139 140 143 145 146 149 150 152 153 160 163 169 171 174 175 176 178 179 ...

result:

ok ok 1 cases (1 test case)

Test #13:

score: 0
Accepted
time: 108ms
memory: 16752kb

input:

556
22 1 1
2 1
2 1000000000
1 2
1000000000 2
1 3
1000000000 3
1 4
1000000000 4
1 5
1000000000 5
1 6
1000000000 6
1 7
1000000000 7
1 8
1000000000 8
1 9
1000000000 9
1 10
1000000000 10
1 11
1000000000 11
2 2
18 3 1
2 1
2 1000000000
3 1
3 1000000000
1 2
1000000000 2
1 3
1000000000 3
1 4
1000000000 4
1 ...

output:

29
1 
19
1 
20
1 5 
14
2 5 
25
2 
28
1 2 3 4 6 8 9 
23
1 
29
3 5 8 10 11 
28
2 3 5 6 
5
1 
23
6 7 8 9 11 
31
2 3 5 10 13 14 15 
29
2 3 
7
1 
26
1 
27
2 3 6 9 12 13 
24
1 5 7 
14
3 5 
32
3 4 5 6 10 11 13 14 
24
1 2 5 
27
1 2 3 6 7 10 
32
1 2 3 4 5 9 14 15 
30
1 3 5 
24
2 3 7 
15
2 3 6 
26
1 
18
1 2 6...

result:

ok ok 556 cases (556 test cases)

Test #14:

score: 0
Accepted
time: 369ms
memory: 35448kb

input:

1
100000 49999 24999
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

99996
1 2 8 11 13 14 15 16 17 19 20 21 26 29 31 36 39 42 45 46 49 51 53 54 55 57 61 62 64 67 68 69 71 73 74 76 78 79 80 81 82 84 85 88 89 91 94 100 101 103 104 109 110 112 113 115 116 120 123 127 130 131 132 133 136 141 147 149 150 151 153 154 155 158 159 161 163 167 168 170 171 173 174 175 177 178 ...

result:

ok ok 1 cases (1 test case)

Test #15:

score: 0
Accepted
time: 169ms
memory: 30284kb

input:

1
100000 49998 34141
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

118282
1 2 3 4 5 6 7 8 11 12 14 15 16 22 23 25 26 27 28 29 30 32 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 63 64 65 66 67 68 69 71 72 73 74 75 76 77 79 80 81 82 83 85 86 87 88 91 92 93 94 95 96 98 99 100 101 102 103 104 105 107 108 109 112 113 114 115 116 117 1...

result:

ok ok 1 cases (1 test case)

Test #16:

score: 0
Accepted
time: 170ms
memory: 33708kb

input:

1
100000 82275 67072
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

119590
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 28 29 30 31 32 33 34 36 37 38 40 41 43 44 45 46 47 48 49 50 51 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 99 100 101 102 103 104 ...

result:

ok ok 1 cases (1 test case)

Test #17:

score: 0
Accepted
time: 93ms
memory: 18392kb

input:

556
30 12 6
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
1 2
1000000000 2
1 3
1000000000 3
1 4
1000000000 4
1 5
1000000000 5
1 6
1000000000 6
1 7
1000000000 7
1 8
1000000000 8
1 9
1000000000 9
2 6
2 8
3 4
4 4
4 8
5 3
5 7
5 8
6...

output:

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

result:

ok ok 556 cases (556 test cases)

Test #18:

score: 0
Accepted
time: 255ms
memory: 37436kb

input:

1
100000 99991 75553
2 1
2 1000000000
3 1
3 1000000000
4 1
4 1000000000
5 1
5 1000000000
6 1
6 1000000000
7 1
7 1000000000
8 1
8 1000000000
9 1
9 1000000000
10 1
10 1000000000
11 1
11 1000000000
12 1
12 1000000000
13 1
13 1000000000
14 1
14 1000000000
15 1
15 1000000000
16 1
16 1000000000
17 1
17 10...

output:

101120
1 2 5 6 7 9 11 12 13 15 16 17 18 19 20 21 23 25 26 27 28 30 31 32 33 35 37 39 40 41 42 43 46 47 50 52 54 55 56 57 59 60 62 63 65 66 67 68 69 71 72 73 74 75 76 77 78 80 81 82 84 86 87 88 89 90 91 92 93 95 96 97 98 101 102 103 104 105 106 107 109 110 111 112 114 115 116 117 118 119 120 122 123 ...

result:

ok ok 1 cases (1 test case)

Extra Test:

score: 0
Extra Test Passed