QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549597#9169. -is-this-bitset-ucup-team3519#AC ✓429ms121540kbC++232.9kb2024-09-06 18:09:532024-09-06 18:09:54

Judging History

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

  • [2024-09-06 18:09:54]
  • 评测
  • 测评结果:AC
  • 用时:429ms
  • 内存:121540kb
  • [2024-09-06 18:09:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define V vector
#define pb push_back
#define fi first
#define se second
#define all1(x) (x).begin() + 1, (x).end()
typedef pair<int, int> pi;


int main() {
    int n; cin >> n;
    V<V<int>> e(n + 1);
    V<int> dep(n + 1);
    V<int> f(n + 1);
    auto dfs = [&](int x, int p, auto dfs) -> void {
        f[x] = p;
        dep[x] = 1;
        for(auto y : e[x]) {
            if(y == p) continue;
            dfs(y, x, dfs);
            dep[x] = max(dep[y] + 1, dep[x]);
        }
    };
    for(int i = 1; i < n; i++) {
        int a, b; cin >> a >> b;
        e[a].pb(b), e[b].pb(a);
    }
    dfs(1, 0, dfs);

    V<int> a(n + 1), b(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++) {
        cin >> b[i];
    }
    

    priority_queue<pi> pq;
    pq.push({dep[1], 1});
    
    for(int i = 1; i <= min(n, 5000); i++) {
        auto [_, x] = pq.top();
        // cout << "need : " << _ << " " << "x : " << x << endl;
        pq.pop();
        if(x == 1) a[x] = 1;
        else a[x] = min((int)2e6, a[f[x]] * 2);
        for(auto y : e[x]) {
            if(y == f[x]) continue;
            int tmp = min(dep[y], (int)1e6 / a[x] / 2);
            pq.push({tmp, y});
        }
    }

    auto mer = [&](V<pi> a, int x) -> V<pi> {
        V<pi> ans;
        int l = 0, r = 0;
        while(l != a.size() || r != a.size()) {
            int to_l, to_r;
            if(r == a.size() || (l != a.size() && a[l].fi < a[r].fi + x)) {
                to_l = a[l].fi, to_r = a[l].se;
                l++;
            } else {
                to_l = a[r].fi + x, to_r = a[r].se + x;
                r++;
            }
            if(ans.empty() || ans.back().se < to_l - 1) {
                if(to_l < 2e6) ans.pb({to_l, min((int)2e6, to_r)});
            } else {
                ans.back().se = min((int)2e6, max(ans.back().se, to_r));
            }
        }
        return ans;
    };

    V<int> ans(n + 1);
    V<V<pi>> dp(n + 1);

    auto cal = [&](int x, int p, auto dfs) -> void {
        // cout << "done : " << x << endl;
        dp[x] = mer(dp[p], a[x]);
        for(auto [l, r] : dp[x]) {
            if(l <= b[x] && r >= b[x]) ans[x] = 1;
        }
        for(auto y : e[x]) {
            if(y == p) continue;
            // cout << "wtf : " << y << endl;
            dfs(y, x, dfs);
        }
    };
    dp[0] = {{0, 0}};
    cal(1, 0, cal);

    for(int i = 1; i <= n; i++) {
        // cout << "i : " << i << endl;
        // for(auto [l, r] : dp[i]) cout << l << " " << r << endl;
        // assert(dp[i].size() < 50);
    }
    // for(int i = 1; i <= n; i++) cout << dep[i] << " ";
    // cout << endl;

    for(int i = 1; i <= n; i++) cout << a[i] << " ";
    cout << endl;
    for(int i = 1; i <= n; i++) cout << ans[i];
    cout << endl;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
2 1
1 3
3 4
5 4
1 3 11 12 6
0 5 12 13 18

output:

1 2 2 4 8 
10000

result:

ok Everything ok

Test #2:

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

input:

1
2000000
2000000

output:

1 
0

result:

ok Everything ok

Test #3:

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

input:

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

output:

1 2 2 4 4 
01111

result:

ok Everything ok

Test #4:

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

input:

10
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
10 5
5 6 0 7 7 10 2 3 4 4
1 2 3 4 5 5 0 0 4 4

output:

1 2 2 4 4 4 4 8 8 8 
1111111111

result:

ok Everything ok

Test #5:

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

input:

10
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
10 5
7 8 2 1 0 10 4 3 10 6
0 9 5 4 5 0 3 7 6 3

output:

1 2 2 4 4 4 4 8 8 8 
1001111111

result:

ok Everything ok

Test #6:

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

input:

10
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
10 5
9 9 8 6 9 10 1 10 6 9
5 8 8 2 2 2 8 5 4 6

output:

1 2 2 4 4 4 4 8 8 8 
0001110111

result:

ok Everything ok

Test #7:

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

input:

10
2 1
3 1
4 2
5 2
6 3
7 3
8 4
9 4
10 5
0 0 9 9 10 2 0 3 5 0
4 3 10 6 2 1 4 7 6 5

output:

1 2 2 4 4 4 4 8 8 8 
0101111111

result:

ok Everything ok

Test #8:

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

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 
00000000010001...

result:

ok Everything ok

Test #9:

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

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #10:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #11:

score: 0
Accepted
time: 5ms
memory: 4248kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #12:

score: 0
Accepted
time: 6ms
memory: 4412kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #13:

score: 0
Accepted
time: 52ms
memory: 11924kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 109ms
memory: 26008kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #15:

score: 0
Accepted
time: 365ms
memory: 79428kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 295ms
memory: 121024kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #17:

score: 0
Accepted
time: 291ms
memory: 121036kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 300ms
memory: 121380kb

input:

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

output:

1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000...

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 11ms
memory: 4416kb

input:

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

output:

1 2 2 4 8 4 4 8 8 16 8 16 32 4 32 32 8 64 16 16 32 64 16 32 64 8 128 64 16 64 128 64 128 256 8 32 16 8 16 32 128 128 32 32 64 16 64 128 256 16 32 64 64 16 128 16 64 256 16 512 32 128 64 64 256 32 128 128 32 256 128 32 512 32 512 64 128 128 64 32 16 32 64 128 512 64 256 32 1024 128 256 256 64 64 256 ...

result:

ok Everything ok

Test #20:

score: 0
Accepted
time: 9ms
memory: 4640kb

input:

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

output:

1 2 2 4 4 4 8 8 8 16 32 16 8 4 32 8 64 64 64 128 64 32 16 128 256 16 32 32 512 8 256 16 16 64 16 32 256 128 128 128 32 64 128 512 16 1024 64 128 512 256 256 16 64 1024 32 512 8 16 32 128 256 16 16 1024 128 256 512 256 128 2048 128 32 16 256 512 16 256 32 2048 2048 1024 512 1024 32 32 512 64 32 128 2...

result:

ok Everything ok

Test #21:

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

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #22:

score: 0
Accepted
time: 275ms
memory: 42204kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #23:

score: 0
Accepted
time: 269ms
memory: 41872kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #24:

score: 0
Accepted
time: 270ms
memory: 41736kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #25:

score: 0
Accepted
time: 273ms
memory: 41840kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #26:

score: 0
Accepted
time: 273ms
memory: 42048kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #27:

score: 0
Accepted
time: 258ms
memory: 41948kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #28:

score: 0
Accepted
time: 269ms
memory: 42132kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #29:

score: 0
Accepted
time: 263ms
memory: 41816kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #30:

score: 0
Accepted
time: 270ms
memory: 121540kb

input:

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

output:

1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000000 2000...

result:

ok Everything ok

Test #31:

score: 0
Accepted
time: 429ms
memory: 72036kb

input:

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

output:

1 2 4 2 4 4 8 8 16 32 32 16 8 8 16 32 32 64 8 16 16 64 64 32 128 64 16 128 64 32 32 128 128 32 128 128 256 256 32 256 128 512 64 256 128 512 16 512 1024 128 64 512 256 512 32 16 4 256 128 8 64 32 256 64 128 64 64 128 32 128 8 64 256 8 128 128 512 512 128 32 128 256 256 16 2048 256 16 128 256 1024 25...

result:

ok Everything ok

Test #32:

score: 0
Accepted
time: 271ms
memory: 120512kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #33:

score: 0
Accepted
time: 268ms
memory: 120504kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #34:

score: 0
Accepted
time: 275ms
memory: 120500kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #35:

score: 0
Accepted
time: 277ms
memory: 120580kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Test #36:

score: 0
Accepted
time: 285ms
memory: 120424kb

input:

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

output:

1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 ...

result:

ok Everything ok

Extra Test:

score: 0
Extra Test Passed