QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#512684#9169. -is-this-bitset-ucup-team1004#AC ✓1299ms52052kbC++142.4kb2024-08-10 15:22:132024-08-10 15:22:13

Judging History

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

  • [2024-08-10 15:22:13]
  • 评测
  • 测评结果:AC
  • 用时:1299ms
  • 内存:52052kb
  • [2024-08-10 15:22:13]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned ll;using pii=pair<int,int>;
const int N=3e5+5,M=N*100+5,K=1e7+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const ll INF=5e18+7;mt19937 rnd(time(0));
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n;
int k=12,lim=2e6;
vector<int> S[N];
int siz[N],son[N],d[N],fa[N];
void make(int x,int La){
	siz[x]=1;fa[x]=La;d[x]=d[La]+1;
	for(int i:S[x]) if(i^La) make(i,x),siz[x]+=siz[i],siz[i]>siz[son[x]]&&(son[x]=i);
}
int A[N],B[N],ans[N];
void work(vector<pii> &f,int k){
	int len=f.size();
	vector<pii> A=f;
	for(int i=0;i<len;i++) A[i]=f[i];
	for(int i=0;i<len;i++) if(f[i].fi+k<=lim) A.emplace_back(f[i].fi+k,min(lim,f[i].se+k));
	inplace_merge(A.begin(),A.begin()+len,A.end());
	f.clear();
	for(auto i:A){
		if(f.empty()||f.back().se<i.fi-1) f.push_back(i);
		else f.back().se=max(f.back().se,i.se);
	}
}
int cts=0;
void dfs(int x,int La,vector<pii> &f){
	work(f,A[x]);
	for(auto i:f) if(i.fi<=B[x]&&B[x]<=i.se) ans[x]=1;
	for(int i:S[x]) if(i^La&&i^son[x]){
		vector<pii> g=f;
		dfs(i,x,g);
		g.clear();g.shrink_to_fit();
	}
	if(son[x]) dfs(son[x],x,f);
}
void Solve(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int x,y;scanf("%d%d",&x,&y);
		S[x].push_back(y);S[y].push_back(x);
	}
	for(int i=1;i<=n;i++) scanf("%d",&A[i]);
	for(int i=1;i<=n;i++) scanf("%d",&B[i]);
	make(1,0);
	for(int i=1;i<=n;i++) if(d[i]<=k) A[i]=(1<<d[i]-1);
	vector<pii> f;f.emplace_back(0,0);
	dfs(1,0,f);
	for(int i=1;i<=n;i++) printf("%d%c",A[i]," \n"[i==n]);
	for(int i=1;i<=n;i++) printf("%d",ans[i]);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 18256kb

input:

1
2000000
2000000

output:

1
0

result:

ok Everything ok

Test #3:

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

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: 15300kb

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: 3ms
memory: 18296kb

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: 2ms
memory: 16892kb

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: 2ms
memory: 16544kb

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: 3ms
memory: 18260kb

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
000000000100010...

result:

ok Everything ok

Test #9:

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

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: 0ms
memory: 15388kb

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: 15604kb

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: 5ms
memory: 17668kb

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: 24ms
memory: 17540kb

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: 53ms
memory: 21720kb

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: 183ms
memory: 28800kb

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: 129ms
memory: 52028kb

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: 132ms
memory: 51900kb

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: 124ms
memory: 52052kb

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 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 1322585 39068 1169305 1265538 235731 1...

result:

ok Everything ok

Test #19:

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

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: 8ms
memory: 15680kb

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: 239ms
memory: 28780kb

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: 152ms
memory: 28576kb

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: 127ms
memory: 28580kb

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: 127ms
memory: 28540kb

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: 128ms
memory: 28772kb

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: 129ms
memory: 28664kb

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: 129ms
memory: 28624kb

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: 124ms
memory: 28780kb

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: 115ms
memory: 28516kb

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: 125ms
memory: 51996kb

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 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 999 999 999 1000 999 1000 1000 10...

result:

ok Everything ok

Test #31:

score: 0
Accepted
time: 338ms
memory: 28636kb

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: 127ms
memory: 51644kb

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: 122ms
memory: 51636kb

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: 1299ms
memory: 51688kb

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: 1081ms
memory: 51720kb

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: 960ms
memory: 51684kb

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