QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#513913#9169. -is-this-bitset-ucup-team4504#AC ✓319ms50780kbC++142.4kb2024-08-10 20:44:332024-08-10 20:44:33

Judging History

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

  • [2024-08-10 20:44:33]
  • 评测
  • 测评结果:AC
  • 用时:319ms
  • 内存:50780kb
  • [2024-08-10 20:44:33]
  • 提交

answer

//#pragma GCC optimize("Ofast","inline","-ffast-math")
//#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int n,a[300010],b[300010],dep[300010],d[300010],ok[300010];
vector<int> v[300010];
short dp[150010][510],now[510];

const int B=500;

inline void predfs(int x,int pr)
{
	int cnt=0;
	for(int i=0;i<(int)v[x].size();i++) if(v[x][i]!=pr){
		dep[v[x][i]]=dep[x]+1;cnt++;
	}
	if(cnt<=1){
		for(int i=0;i<(int)v[x].size();i++) if(v[x][i]!=pr){
			d[v[x][i]]=d[x];
		}
	}
	else{
		for(int i=0;i<(int)v[x].size();i++) if(v[x][i]!=pr){
			d[v[x][i]]=d[x]+1;
		}
	}
	for(int i=0;i<(int)v[x].size();i++) if(v[x][i]!=pr){
		predfs(v[x][i],x);
	}
}

inline void dfs(int x,int pr)
{
	ok[x]=0;
	if(dep[x]<=11){
		if(b[x]%B==0&&b[x]/B<=(1<<(dep[x]+1))-1) ok[x]=1;
	}
	else{
		for(int i=0;i<B;i++) now[i]=dp[d[x]][i];
		for(int i=0;i<B;i++){
			int cur=i+(a[x]%B);
			if(cur<B) now[cur]=min(now[cur],(short)(dp[d[x]][i]+a[x]/B));
			else now[cur-B]=min(now[cur-B],(short)(dp[d[x]][i]+a[x]/B+1));
		}
		for(int i=0;i<B;i++) dp[d[x]][i]=now[i];
		if(b[x]/B>=dp[d[x]][b[x]%B]) ok[x]=1;
	}
	for(int i=0;i<(int)v[x].size();i++) if(v[x][i]!=pr){
		if(d[v[x][i]]>d[x]){
			for(int j=0;j<B;j++) dp[d[v[x][i]]][j]=dp[d[x]][j];
		}
		dfs(v[x][i],x);
	}
}

signed main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n;
	for(int i=1;i<n;i++){
		int x,y;cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>b[i];
	dep[1]=0;d[1]=0;predfs(1,-1);
	for(int i=1;i<=n;i++) if(dep[i]<=11) a[i]=(1<<dep[i])*B;
	for(int i=1;i<=n;i++) cout<<a[i]<<' ';
	cout<<'\n';
	for(int i=0;i<B;i++) dp[d[1]][i]=10000;
	dp[d[1]][0]=0;
	dfs(1,-1);
	for(int i=1;i<=n;i++) cout<<ok[i];
	cout<<'\n';
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 15848kb

input:

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

output:

500 1000 1000 2000 4000 
10000

result:

ok Everything ok

Test #2:

score: 0
Accepted
time: 3ms
memory: 15908kb

input:

1
2000000
2000000

output:

500 
0

result:

ok Everything ok

Test #3:

score: 0
Accepted
time: 3ms
memory: 17996kb

input:

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

output:

500 1000 1000 2000 2000 
00101

result:

ok Everything ok

Test #4:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 
0000001100

result:

ok Everything ok

Test #5:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 
1000010000

result:

ok Everything ok

Test #6:

score: 0
Accepted
time: 2ms
memory: 15856kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 
0000000000

result:

ok Everything ok

Test #7:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 
0000000000

result:

ok Everything ok

Test #8:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #9:

score: 0
Accepted
time: 3ms
memory: 15944kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #10:

score: 0
Accepted
time: 3ms
memory: 16024kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #11:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #12:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #13:

score: 0
Accepted
time: 46ms
memory: 17520kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 95ms
memory: 19448kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #15:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 231ms
memory: 50096kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #17:

score: 0
Accepted
time: 224ms
memory: 49828kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 213ms
memory: 50392kb

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:

500 1000 2000 4000 8000 16000 32000 64000 128000 256000 512000 1024000 756943 37612 782401 1971767 1786796 1410138 565803 1186136 881774 238795 1035245 791846 1163247 1499684 1364227 1761140 559551 107453 1789884 1826085 901175 921436 333619 569499 132107 1707245 397390 683917 1383815 1456724 132258...

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 8ms
memory: 16328kb

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:

500 1000 1000 2000 4000 2000 2000 4000 4000 8000 4000 8000 16000 2000 16000 16000 4000 32000 8000 8000 16000 32000 8000 16000 32000 4000 64000 32000 8000 32000 64000 32000 64000 128000 4000 16000 8000 4000 8000 16000 64000 64000 16000 16000 32000 8000 32000 64000 128000 8000 16000 32000 32000 8000 6...

result:

ok Everything ok

Test #20:

score: 0
Accepted
time: 8ms
memory: 16316kb

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:

500 1000 1000 2000 2000 2000 4000 4000 4000 8000 16000 8000 4000 2000 16000 4000 32000 32000 32000 64000 32000 16000 8000 64000 128000 8000 16000 16000 256000 4000 128000 8000 8000 32000 8000 16000 128000 64000 64000 64000 16000 32000 64000 256000 8000 512000 32000 64000 256000 128000 128000 8000 32...

result:

ok Everything ok

Test #21:

score: 0
Accepted
time: 254ms
memory: 27572kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #22:

score: 0
Accepted
time: 223ms
memory: 26648kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #23:

score: 0
Accepted
time: 242ms
memory: 27380kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #24:

score: 0
Accepted
time: 222ms
memory: 26548kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #25:

score: 0
Accepted
time: 248ms
memory: 26736kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #26:

score: 0
Accepted
time: 216ms
memory: 26932kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #27:

score: 0
Accepted
time: 213ms
memory: 27136kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #28:

score: 0
Accepted
time: 231ms
memory: 26144kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #29:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #30:

score: 0
Accepted
time: 224ms
memory: 50780kb

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:

500 1000 2000 4000 8000 16000 32000 64000 128000 256000 512000 1024000 999 999 1000 999 999 999 999 999 999 1000 999 999 999 1000 1000 999 999 1000 1000 999 999 1000 1000 999 999 999 1000 1000 999 1000 999 1000 999 999 999 999 1000 999 999 999 1000 1000 1000 1000 999 999 999 1000 1000 999 1000 999 9...

result:

ok Everything ok

Test #31:

score: 0
Accepted
time: 319ms
memory: 27712kb

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:

500 1000 2000 1000 2000 2000 4000 4000 8000 16000 16000 8000 4000 4000 8000 16000 16000 32000 4000 8000 8000 32000 32000 16000 64000 32000 8000 64000 32000 16000 16000 64000 64000 16000 64000 64000 128000 128000 16000 128000 64000 256000 32000 128000 64000 256000 8000 256000 512000 64000 32000 25600...

result:

ok Everything ok

Test #32:

score: 0
Accepted
time: 252ms
memory: 49160kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #33:

score: 0
Accepted
time: 249ms
memory: 49520kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #34:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #35:

score: 0
Accepted
time: 245ms
memory: 49584kb

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Test #36:

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

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:

500 1000 1000 2000 2000 2000 2000 4000 4000 4000 4000 4000 4000 4000 4000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 8000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16000 16...

result:

ok Everything ok

Extra Test:

score: 0
Extra Test Passed