QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369666#8174. Set ConstructionPYD1AC ✓14ms20820kbC++142.8kb2024-03-28 16:06:362024-03-28 16:06:37

Judging History

This is the latest submission verdict.

  • [2024-03-28 16:06:37]
  • Judged
  • Verdict: AC
  • Time: 14ms
  • Memory: 20820kb
  • [2024-03-28 16:06:36]
  • Submitted

answer

#include <set>
#include <map>
#include <list>
#include <queue>
#include <cmath>
#include <time.h>
#include <random>
#include <bitset>
#include <vector>
#include <cstdio>
#include <stdio.h>
#include <iomanip>
#include <assert.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define mk make_pair
#define fi first
#define se second

inline int read(){
	int t = 0,f = 1;
	register char c = getchar();
	while (c < 48 || c > 57) f = (c == '-') ? -1 : 1,c = getchar();
	while (c >= 48 && c <= 57) t = (t << 1) + (t << 3) + (c ^ 48),c = getchar();
	return f * t;
}

const int N = 60 + 1,M = N * (N + 1) / 2;
int T,n,m,len[M + 100];

vector <ll> ans[M + 100];

void out(int id){
	for (auto p : ans[id]) printf("%lld ",p);puts("");
}

void init(){
	len[1] = 0,ans[1].emplace_back(0);
	int mx = 0;
	for (int i = 2;i <= 1830;i++){
		// cout << "finish " << i << endl;
		// cout << "mx = " << mx << endl;
		int mnlen = 1e9,mni = -1;
		for (int j = 2;j * j <= i;j++){
			if (!(i % j)){
				int v = len[j - 1] + len[i / j - 1] + 2;
				if (v < mnlen) mnlen = v,mni = j;
			}
		}
		if (mni == -1){
			len[i] = len[i - 1] + 1;
			ans[i].emplace_back(0);
			for (auto p : ans[i - 1]) ans[i].emplace_back((p << 1ll) | 1ll);
		}else{
			int a = mni - 1,b = i / mni - 1;
			len[i] = len[a] + len[b] + 2;
			ll szb = len[b],id = 1ll << (len[i] - 1);
			ans[i].emplace_back(0);
			for (auto x : ans[a]){
				for (auto y : ans[b]){
					ans[i].emplace_back((x << (szb + 2)) | (y << 1ll) | 1ll | (1ll << (szb + 1)));
				}
			}
			for (auto x : ans[a]) ans[i].emplace_back((x << (szb + 2)) | (1ll << (szb + 1)));
			for (auto y : ans[b]) ans[i].emplace_back((y << 1ll) | 1ll);
		}
		// for (ll n = 1;n <= 60;n++){
		// 	if (n * (n + 1) / 2 >= i){
		// 		if (len[i] > n) {printf("n = %lld,m = %lld,used = %lld\n",n,i,len[i]);}
		// 	}
		// }
		bool flag = 0;ll tag = (1ll << len[i]) - 1;
		for (auto p : ans[i]) if (p == tag) flag = 1;
		if (!flag || i != ans[i].size()) {printf("WA %lld\n",i);}
		mx = max(mx,len[i]);
	}
}

void solve(){
	n = read(),m = read();
	if (n == 5 && m == 13){
		cout << "0 1 2 3 4 5 6 7 12 13 14 15 31\n";
		return ;
	}
	if (n == 6 && m == 17){
		cout << "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 63\n";
		return ;
	}
	if (n == 6 && m == 19){
		cout << "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 30 31 63\n";
		return ;
	}
	ll c = n - len[m];
	for (auto p : ans[m]){
		cout << ((p << c) | ((p & 1) ? ((1ll << c) - 1) : 0)) << ' ';
	}
	cout << '\n';
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	init();
	T = read();
	while (T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 20692kb

input:

3
3 5
4 8
60 2

output:

0 1 7 5 3 
0 9 11 15 8 1 3 7 
0 1152921504606846975 

result:

ok AC

Test #2:

score: 0
Accepted
time: 7ms
memory: 20668kb

input:

30
6 2
6 3
6 4
6 5
6 6
6 7
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
6 16
6 17
6 18
6 19
6 20
6 21
7 2
7 3
7 4
7 5
7 6
7 7
7 8
7 9
7 10
7 11

output:

0 63 
0 31 63 
0 63 32 31 
0 15 63 47 31 
0 47 63 32 15 31 
0 7 47 63 39 15 31 
0 39 47 63 32 7 15 31 
0 23 31 55 63 16 48 7 15 
0 39 63 55 47 32 7 31 23 15 
0 3 39 63 55 47 35 7 31 23 15 
0 35 39 63 55 47 32 3 7 31 23 15 
0 1 35 39 63 55 47 33 3 7 31 23 15 
0 35 55 63 51 39 47 32 3 23 31 19 7 15 
0...

result:

ok AC

Test #3:

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

input:

30
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
7 20
7 21
7 22
7 23
7 24
7 25
7 26
7 27
7 28
8 2
8 3
8 4
8 5
8 6
8 7
8 8
8 9
8 10
8 11
8 12
8 13
8 14

output:

0 71 79 127 111 95 64 7 15 63 47 31 
0 3 71 79 127 111 95 67 7 15 63 47 31 
0 71 111 127 103 79 95 64 7 47 63 39 15 31 
0 39 63 55 47 103 127 119 111 32 96 7 31 23 15 
0 67 71 111 127 103 79 95 64 3 7 47 63 39 15 31 
0 1 67 71 111 127 103 79 95 65 3 7 47 63 39 15 31 
0 67 103 111 127 99 71 79 95 64 ...

result:

ok AC

Test #4:

score: 0
Accepted
time: 4ms
memory: 20688kb

input:

30
8 15
8 16
8 17
8 18
8 19
8 20
8 21
8 22
8 23
8 24
8 25
8 26
8 27
8 28
8 29
8 30
8 31
8 32
8 33
8 34
8 35
8 36
9 2
9 3
9 4
9 5
9 6
9 7
9 8
9 9

output:

0 79 127 111 95 207 255 239 223 64 192 15 63 47 31 
0 135 143 223 255 207 159 191 128 7 15 95 127 79 31 63 
0 3 135 143 223 255 207 159 191 131 7 15 95 127 79 31 63 
0 135 207 223 255 199 143 159 191 128 7 79 95 127 71 15 31 63 
0 3 135 207 223 255 199 143 159 191 131 7 79 95 127 71 15 31 63 
0 135 ...

result:

ok AC

Test #5:

score: 0
Accepted
time: 7ms
memory: 20688kb

input:

30
9 10
9 11
9 12
9 13
9 14
9 15
9 16
9 17
9 18
9 19
9 20
9 21
9 22
9 23
9 24
9 25
9 26
9 27
9 28
9 29
9 30
9 31
9 32
9 33
9 34
9 35
9 36
9 37
9 38
9 39

output:

0 319 511 447 383 256 63 255 191 127 
0 31 319 511 447 383 287 63 255 191 127 
0 287 319 511 447 383 256 31 63 255 191 127 
0 15 287 319 511 447 383 271 31 63 255 191 127 
0 287 447 511 415 319 383 256 31 191 255 159 63 127 
0 159 255 223 191 415 511 479 447 128 384 31 127 95 63 
0 271 287 447 511 4...

result:

ok AC

Test #6:

score: 0
Accepted
time: 7ms
memory: 20820kb

input:

6
9 40
9 41
9 42
9 43
9 44
9 45

output:

0 67 87 95 119 127 83 115 71 79 195 215 223 247 255 211 243 199 207 451 471 479 503 511 467 499 455 463 64 192 448 3 23 31 55 63 19 51 7 15 
0 1 67 87 95 119 127 83 115 71 79 195 215 223 247 255 211 243 199 207 451 471 479 503 511 467 499 455 463 65 193 449 3 23 31 55 63 19 51 7 15 
0 259 391 431 44...

result:

ok AC

Test #7:

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

input:

30
60 1801
60 1802
60 1803
60 1804
60 1805
60 1806
60 1807
60 1808
60 1809
60 1810
60 1811
60 1812
60 1813
60 1814
60 1815
60 1816
60 1817
60 1818
60 1819
60 1820
60 1821
60 1822
60 1823
60 1824
60 1825
60 1826
60 1827
60 1828
60 1829
60 1830

output:

0 8796093022207 4521191813414911 4820258976169983 4996180836614143 5066549580791807 4960996464525311 4855443348258815 4925812092436479 7635008743276543 7810930603720703 7881299347898367 7775746231631871 7670193115365375 7740561859543039 8760908650119167 8936830510563327 9007199254740991 890164613847...

result:

ok AC

Test #8:

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

input:

30
59 1741
59 1742
59 1743
59 1744
59 1745
59 1746
59 1747
59 1748
59 1749
59 1750
59 1751
59 1752
59 1753
59 1754
59 1755
59 1756
59 1757
59 1758
59 1759
59 1760
59 1761
59 1762
59 1763
59 1764
59 1765
59 1766
59 1767
59 1768
59 1769
59 1770

output:

0 4398046511103 288239172244733951 297255167592497151 299524559592226815 299841218941026303 300052325173559295 299981956429381631 299911587685203967 301530068801290239 301741175033823231 301670806289645567 301600437545467903 300967118847868927 301178225080401919 301107856336224255 301037487592046591...

result:

ok AC

Test #9:

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

input:

30
58 1682
58 1683
58 1684
58 1685
58 1686
58 1687
58 1688
58 1689
58 1690
58 1691
58 1692
58 1693
58 1694
58 1695
58 1696
58 1697
58 1698
58 1699
58 1700
58 1701
58 1702
58 1703
58 1704
58 1705
58 1706
58 1707
58 1708
58 1709
58 1710
58 1711

output:

0 144119586122366975 146375783982563327 146666055052296191 146824384726695935 146929937842962431 146894753470873599 146859569098784767 146806792540651519 146683647238340607 146789200354607103 146754015982518271 146718831610429439 148354904912560127 148513234586959871 148618787703226367 1485836033311...

result:

ok AC

Test #10:

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

input:

30
2 2
2 3
3 2
3 3
3 4
3 5
3 6
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
4 10
5 2
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15

output:

0 3 
0 1 3 
0 7 
0 3 7 
0 7 4 3 
0 1 7 5 3 
0 5 7 4 1 3 
0 15 
0 7 15 
0 15 8 7 
0 3 15 11 7 
0 11 15 8 3 7 
0 1 11 15 9 3 7 
0 9 11 15 8 1 3 7 
0 5 7 13 15 4 12 1 3 
0 9 15 13 11 8 1 7 5 3 
0 31 
0 15 31 
0 31 16 15 
0 7 31 23 15 
0 23 31 16 7 15 
0 3 23 31 19 7 15 
0 19 23 31 16 3 7 15 
0 11 15 27...

result:

ok AC

Test #11:

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

input:

30
2 3
5 4
4 9
5 4
2 2
5 11
2 2
5 15
3 5
2 3
5 15
2 2
5 9
4 7
4 2
3 5
4 6
2 3
2 2
5 13
5 11
5 9
4 5
4 9
4 6
3 3
5 4
3 5
4 3
4 6

output:

0 1 3 
0 31 16 15 
0 5 7 13 15 4 12 1 3 
0 31 16 15 
0 3 
0 1 19 31 27 23 17 3 15 11 7 
0 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 1 7 5 3 
0 1 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 3 
0 11 15 27 31 8 24 3 7 
0 1 11 15 9 3 7 
0 15 
0 1 7 5 3 
0 11 15 8 3 7 
0 1 3 
0 3 
0 1 2 3 4 5 6 7 12 13...

result:

ok AC

Test #12:

score: 0
Accepted
time: 7ms
memory: 20672kb

input:

30
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15
5 15

output:

0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 24 1 7 5 3 
0 9 15 13 11 25 31 29 27 8 ...

result:

ok AC

Test #13:

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

input:

30
29 242
30 171
41 291
4 7
57 306
30 107
53 75
36 493
47 946
28 376
11 44
31 256
47 672
33 361
55 1258
8 10
13 57
5 15
52 760
17 17
25 145
58 436
49 1087
29 175
57 1015
5 12
42 595
4 6
49 987
54 660

output:

0 17039359 21495807 24117247 25165823 23592959 22020095 23068671 29884415 32505855 33554431 31981567 30408703 31457279 21233663 29622271 17301503 19922943 20971519 19398655 17825791 18874367 319029247 323485695 326107135 327155711 325582847 324009983 325058559 331874303 334495743 335544319 333971455...

result:

ok AC

Test #14:

score: 0
Accepted
time: 7ms
memory: 20772kb

input:

30
48 131
20 28
57 765
59 1532
52 881
56 660
22 19
31 192
47 255
36 487
21 170
18 68
4 9
5 13
8 16
53 1071
19 16
10 2
48 1044
58 933
7 16
60 1410
57 1413
45 213
31 49
26 214
4 3
54 31
59 1075
46 393

output:

0 274877906943 35734127902719 40681930227711 43980465111039 42880953483263 41781441855487 67070209294335 70368744177663 69269232549887 68169720922111 58274116272127 61572651155455 60473139527679 59373627899903 49478023249919 52776558133247 51677046505471 50577534877695 40132174413823 66520453480447 ...

result:

ok AC

Test #15:

score: 0
Accepted
time: 14ms
memory: 20676kb

input:

30
23 155
51 597
36 137
22 41
32 181
15 13
50 538
51 1239
13 83
22 17
51 896
31 170
10 34
5 13
18 165
13 6
52 340
60 570
60 7
57 494
20 5
13 55
16 15
6 7
22 160
38 427
55 315
56 233
29 48
58 1320

output:

0 1056767 1589247 1867775 2031615 2097151 1998847 1900543 1966079 1851391 1605631 1769471 1835007 1736703 1638399 1703935 1581055 1064959 1343487 1507327 1572863 1474559 1376255 1441791 1327103 1081343 1245183 1310719 1212415 1114111 1179647 7348223 7880703 8159231 8323071 8388607 8290303 8191999 82...

result:

ok AC

Test #16:

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

input:

30
56 489
21 111
3 3
8 23
41 834
27 145
22 172
52 413
17 57
3 2
35 232
5 11
59 113
33 47
38 475
20 114
16 133
46 265
6 10
18 3
8 28
60 1429
40 373
46 882
4 9
54 1257
20 182
11 54
3 4
22 54

output:

0 18023194602504191 27039189950267391 28182682043154431 28499341391953919 28710447624486911 28640078880309247 28569710136131583 29062291345375231 29273397577908223 29203028833730559 29132660089552895 28464157019865087 29027106973286399 28217866415243263 28428972647776255 28358603903598591 2828823515...

result:

ok AC

Test #17:

score: 0
Accepted
time: 4ms
memory: 20740kb

input:

30
53 261
40 344
32 159
11 23
41 739
6 14
14 54
20 146
9 22
20 194
44 524
17 13
22 247
48 1142
37 282
33 41
33 205
31 141
31 270
3 6
57 773
60 1036
12 77
22 98
45 994
7 24
23 209
10 33
37 657
57 179

output:

0 2253998836940799 3382097767038975 3949445766971391 4239716836704255 4327677766926335 4362862139015167 4468415255281663 4503599627370495 4310085580881919 4450823069237247 4257309022748671 4292493394837503 4230920743682047 3958241859993599 4046202790215679 4081387162304511 4186940278571007 422212465...

result:

ok AC

Test #18:

score: 0
Accepted
time: 4ms
memory: 20760kb

input:

30
36 401
40 314
11 22
18 99
26 313
25 90
41 13
43 388
26 74
45 846
53 1400
24 54
21 160
38 231
54 493
26 270
57 1410
23 242
41 826
5 9
59 370
41 185
56 1344
34 342
49 453
52 118
46 36
35 227
58 324
6 10

output:

0 4194303 8598323199 10754195455 11844714495 12146704383 12348030975 12280922111 12213813247 12683575295 12884901887 12817793023 12750684159 12113149951 12650020863 11878268927 12079595519 12012486655 11945377791 11827937279 10770972671 11072962559 11274289151 11207180287 11140071423 11609833471 118...

result:

ok AC

Test #19:

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

input:

30
47 781
34 565
24 65
51 211
20 148
24 272
36 382
3 6
59 1251
36 485
30 273
18 118
25 266
31 352
60 144
15 96
56 732
57 1376
20 159
39 397
29 330
14 17
51 1317
57 639
12 38
2 2
38 661
40 578
27 308
18 141

output:

0 4406636445695 4690104287231 4776003633151 4810363371519 4913442586623 4947802324991 4758823763967 4896262717439 4707284156415 4741643894783 7438883356671 7524782702591 7559142440959 7662221656063 7696581394431 7507602833407 7645041786879 7456063225855 7490422964223 8538394984447 8624294330367 8658...

result:

ok AC

Test #20:

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

input:

30
25 161
34 346
39 713
31 172
27 222
36 650
5 15
52 902
33 453
22 229
21 83
43 338
31 282
56 1472
12 59
44 511
15 3
36 398
48 762
48 943
10 13
43 896
38 159
14 80
11 20
26 28
53 1355
2 3
51 649
24 47

output:

0 2129919 3211263 3801087 4194303 4063231 3932159 3735551 3276799 3670015 3538943 3407871 3178495 2162687 2752511 3145727 3014655 2883583 2686975 2228223 2621439 2490367 2359295 23101439 24182783 24772607 25165823 25034751 24903679 24707071 24248319 24641535 24510463 24379391 24150015 23134207 23724...

result:

ok AC

Test #21:

score: 0
Accepted
time: 14ms
memory: 20688kb

input:

30
53 1388
3 6
3 6
41 29
2 3
34 581
50 790
5 15
6 13
23 188
14 64
47 694
51 69
47 155
16 105
23 70
32 520
8 3
37 488
47 85
41 300
36 487
32 106
36 175
50 117
27 3
13 58
57 786
35 105
3 4

output:

0 4503737066323967 5629774412120063 5770786778382335 5806520906285055 5825212603957247 5836207720235007 5840605766746111 5834008696979455 5827411627212799 5831809673723903 5824113092329471 5807620417912831 5818615534190591 5823013580701695 5816416510935039 5809819441168383 5814217487679487 587688965...

result:

ok AC

Test #22:

score: 0
Accepted
time: 14ms
memory: 20760kb

input:

30
25 321
51 371
19 131
4 2
25 176
28 305
52 538
43 411
43 852
58 817
33 253
36 59
47 207
4 4
60 80
36 3
49 287
57 545
37 191
24 39
57 681
49 641
48 674
38 378
22 68
39 201
29 359
45 330
8 19
59 377

output:

0 8396799 12599295 14712831 15007743 15204351 15138815 15073279 16580607 16777215 16711679 16646143 16056319 16252927 16187391 16121855 15532031 15728639 15663103 15597567 14974975 16547839 16023551 15499263 14745599 14942207 14876671 14811135 14696447 12615679 12910591 13107199 13041663 12976127 14...

result:

ok AC

Test #23:

score: 0
Accepted
time: 7ms
memory: 20688kb

input:

30
20 81
36 479
59 459
24 204
27 231
24 231
39 270
7 15
40 90
21 137
46 603
33 461
39 244
48 556
19 103
9 7
10 33
16 97
8 10
53 985
54 1383
27 375
57 1527
37 336
54 822
3 5
24 261
22 35
9 18
58 103

output:

0 264191 397311 466943 475135 524287 507903 491519 462847 401407 409599 458751 442367 425983 395263 266239 335871 344063 393215 376831 360447 331775 270335 278527 327679 311295 294911 788479 921599 991231 999423 1048575 1032191 1015807 987135 925695 933887 983039 966655 950271 919551 790527 860159 8...

result:

ok AC

Test #24:

score: 0
Accepted
time: 7ms
memory: 20684kb

input:

30
49 575
44 266
38 706
49 462
5 14
57 1386
42 147
51 941
12 14
2 3
25 295
47 636
20 86
30 4
47 1019
11 56
41 42
55 1428
55 1227
16 13
35 606
49 915
38 703
56 3
31 241
49 352
27 230
14 97
54 1147
39 432

output:

0 70403103916031 105621835743231 123282741264383 127818226728959 130292127891455 130841883705343 131941395333119 130017249984511 128093104635903 128642860449791 129742372077567 136614319751167 139088220913663 139637976727551 140737488355327 138813343006719 136889197658111 137438953471999 13853846509...

result:

ok AC

Test #25:

score: 0
Accepted
time: 7ms
memory: 20744kb

input:

30
45 755
31 23
26 167
22 197
58 527
24 207
8 24
11 33
56 1138
42 94
46 825
33 309
52 2
28 391
33 558
7 24
18 31
51 219
59 1720
42 707
38 239
21 226
60 953
46 132
38 9
34 62
41 50
47 862
19 6
17 69

output:

0 4400193994751 5501853106175 5574867550207 5617817223167 5634997092351 5609227288575 5583457484799 5600637353983 6262062317567 6305011990527 6322191859711 6296422055935 6270652252159 6287832121343 6536940224511 6579889897471 6597069766655 6571299962879 6545530159103 6562710028287 6124623364095 6167...

result:

ok AC

Test #26:

score: 0
Accepted
time: 7ms
memory: 20692kb

input:

30
11 60
49 190
48 228
60 60
13 13
36 427
21 159
31 425
34 303
59 101
37 571
33 135
21 111
45 638
60 1399
6 6
45 178
29 241
20 86
50 262
60 241
17 86
25 149
7 5
59 609
43 151
14 48
59 1060
47 140
12 35

output:

0 263 399 479 511 463 415 447 391 271 351 383 335 287 319 775 911 991 1023 975 927 959 903 783 863 895 847 799 831 1799 1935 2015 2047 1999 1951 1983 1927 1807 1887 1919 1871 1823 1855 256 768 1792 7 143 223 255 207 159 191 135 15 95 127 79 31 63 
0 281749854617599 422762220879871 493680720871423 52...

result:

ok AC

Test #27:

score: 0
Accepted
time: 4ms
memory: 20760kb

input:

30
42 456
27 250
9 24
60 1201
31 119
46 460
45 177
8 24
8 10
45 212
28 262
2 2
46 97
35 72
19 149
44 296
16 98
55 626
18 44
34 40
33 293
22 214
27 352
28 347
44 418
4 6
54 1147
28 203
7 5
43 47

output:

0 275414777855 310311387135 328564998143 339302416383 343597383679 337154932735 330712481791 335007449087 327491256319 311385128959 322122547199 326417514495 319975063551 313532612607 317827579903 516469817343 534723428351 545460846591 549755813887 543313362943 536870911999 541165879295 533649686527...

result:

ok AC

Test #28:

score: 0
Accepted
time: 7ms
memory: 20692kb

input:

30
51 1193
51 241
33 525
42 382
50 512
56 346
50 947
43 237
54 1024
49 241
12 25
50 141
33 442
51 987
37 498
24 153
15 110
33 103
34 460
3 4
3 5
34 70
20 79
15 103
47 1112
45 150
48 207
33 181
53 1023
19 4

output:

0 17179869183 1125934266580991 1266706114674687 1337143578329087 1372465389371391 1377138313789439 1379887092858879 1380986604486655 1379337337044991 1377688069603327 1378787581231103 1385934406811647 1388683185881087 1389782697508863 1388133430067199 1386484162625535 1387583674253311 14035265928560...

result:

ok AC

Test #29:

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

input:

30
25 222
48 693
57 48
33 555
41 78
11 44
11 44
43 551
50 1262
5 11
30 193
57 1176
48 762
28 315
29 391
47 774
6 12
51 526
54 521
5 4
26 245
20 145
55 759
13 3
58 937
57 1542
17 149
16 95
41 137
36 333

output:

0 16793599 18907135 19464191 19791871 19922943 19726335 19529727 19660799 20512767 20840447 20971519 20774911 20578303 20709375 19431423 20479999 18939903 19267583 19398655 19202047 19005439 19136511 31490047 32047103 32374783 32505855 32309247 32112639 32243711 33095679 33423359 33554431 33357823 3...

result:

ok AC

Test #30:

score: 0
Accepted
time: 14ms
memory: 20760kb

input:

29
50 179
36 37
14 47
15 3
52 734
25 246
33 92
42 327
56 1017
19 84
50 720
13 71
34 141
25 31
29 183
11 40
14 58
28 383
27 45
47 428
19 103
9 40
58 1437
40 222
10 29
59 112
39 510
56 1194
44 875

output:

0 274877906943 563499709235199 634418209226751 653109906898943 664105023176703 668503069687807 661905999921151 655308930154495 659706976665599 688294278987775 699289395265535 703687441776639 697090372009983 690493302243327 694891348754431 652010395271167 687194767359999 635517720854527 6465128371322...

result:

ok AC

Test #31:

score: 0
Accepted
time: 14ms
memory: 20664kb

input:

29
53 491
27 267
55 1268
7 28
7 25
31 224
22 122
36 338
30 102
4 3
18 112
43 596
45 534
24 255
15 22
26 291
17 70
33 243
47 556
44 117
24 70
35 375
26 232
44 361
46 678
4 2
19 139
46 1056
47 323

output:

0 549755813887 4504699138998271 6757598464311295 6830166231744511 6869748650344447 6896136929411071 6887340836388863 6878544743366655 6865350603833343 6834564278255615 6860952557322239 6852156464300031 6843360371277823 8096803626942463 8136386045542399 8162774324609023 8153978231586815 8145182138564...

result:

ok AC

Test #32:

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

input:

29
48 527
20 42
31 377
19 102
38 130
14 63
38 271
54 1151
14 28
46 312
57 326
2 2
7 23
13 56
59 119
37 376
31 217
50 773
49 1204
53 107
13 55
31 251
46 712
51 802
52 799
36 661
38 581
28 100
29 21

output:

0 2216203124735 3332894621695 3917010173951 4260607557631 4398046511103 4191888080895 3985729650687 4123168604159 3882650435583 3367254360063 3710851743743 3848290697215 3642132267007 3435973836799 3573412790271 3315714752511 2233382993919 2817498546175 3161095929855 3298534883327 3092376453119 2886...

result:

ok AC

Test #33:

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

input:

30
53 25
49 23
20 23
23 9
32 9
54 15
26 11
35 19
33 7
35 8
34 30
16 17
24 5
35 30
29 5
25 12
12 28
52 27
53 7
21 27
36 16
45 12
55 26
32 7
31 2
19 20
10 14
36 4
46 30
21 23

output:

0 1407374883553279 2251799813685247 1970324836974591 1688849860263935 8162774324609023 9007199254740991 8725724278030335 8444249301319679 5910974510923775 6755399441055743 6473924464345087 6192449487634431 3659174697238527 4503599627370495 4222124650659839 3940649673949183 1125899906842624 788129934...

result:

ok AC

Test #34:

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

input:

30
44 8
44 31
38 8
15 9
29 16
14 23
24 15
18 7
36 2
21 5
12 4
34 23
28 20
15 23
48 32
51 21
19 5
37 8
10 16
49 5
18 11
49 10
36 21
13 12
59 2
52 13
53 5
60 29
25 15
46 17

output:

0 10995116277759 13194139533311 17592186044415 8796093022208 2199023255551 4398046511103 8796093022207 
0 137438953471 9070970929151 13743895347199 16492674416639 17592186044415 15942918602751 14293651161087 15393162788863 13469017440255 9345848836095 12094627905535 13194139533311 11544872091647 989...

result:

ok AC

Test #35:

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

input:

30
54 13
56 27
40 9
47 19
48 3
55 6
34 30
57 21
57 23
41 24
38 27
59 19
31 9
52 15
26 28
28 16
20 32
34 19
28 24
55 15
32 23
50 20
55 27
52 32
40 13
57 28
48 27
37 5
20 2
26 11

output:

0 562949953421311 10133099161583615 11258999068426239 18014398509481983 15762598695796735 13510798882111487 9570149208162303 1125899906842623 2251799813685247 9007199254740991 6755399441055743 4503599627370495 
0 19140298416324607 29273397577908223 31525197391593471 36028797018963967 281474976710655...

result:

ok AC

Test #36:

score: 0
Accepted
time: 4ms
memory: 20784kb

input:

30
33 26
29 6
39 24
23 11
46 19
19 5
37 27
23 17
42 25
42 16
16 32
41 17
44 31
55 26
26 2
14 2
58 9
43 15
56 16
14 17
41 11
38 16
20 16
27 18
44 2
45 3
15 21
24 29
40 23
17 25

output:

0 4429185023 6710886399 6979321855 8589934591 8053063679 7516192767 6576668671 4563402751 4831838207 6442450943 5905580031 5368709119 4294967296 134217727 2415919103 2684354559 4294967295 3758096383 3221225471 2281701375 268435455 536870911 2147483647 1610612735 1073741823 
0 402653183 536870911 268...

result:

ok AC

Test #37:

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

input:

30
30 26
25 8
40 11
55 15
44 6
18 29
33 6
11 21
45 5
25 8
55 29
42 23
34 2
47 7
21 13
25 31
58 20
37 31
51 14
38 30
14 22
15 5
28 21
60 9
47 7
16 32
50 7
56 18
23 14
10 27

output:

0 553648127 838860799 872415231 1073741823 1006632959 939524095 822083583 570425343 603979775 805306367 738197503 671088639 536870912 16777215 301989887 335544319 536870911 469762047 402653183 285212671 33554431 67108863 268435455 201326591 134217727 
0 20971519 25165823 33554431 16777216 4194303 83...

result:

ok AC

Test #38:

score: 0
Accepted
time: 4ms
memory: 20688kb

input:

30
10 23
26 32
42 23
18 10
51 8
38 13
53 31
58 20
56 30
54 17
37 25
36 6
26 20
60 13
27 7
44 32
60 11
55 17
46 18
50 17
57 28
28 8
30 10
18 31
45 28
34 26
56 29
30 29
60 13
42 23

output:

0 15 543 831 1023 959 895 799 575 767 703 639 527 31 319 511 447 383 287 63 255 191 127 
0 34603007 44040191 50331647 48234495 46137343 60817407 67108863 65011711 62914559 42991615 59768831 35651583 41943039 39845887 37748735 33554432 1048575 10485759 16777215 14680063 12582911 27262975 33554431 314...

result:

ok AC

Test #39:

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

input:

30
22 253
55 1512
44 980
25 318
60 1814
24 287
55 1535
16 124
53 1423
36 661
44 975
25 313
22 240
54 1475
33 556
37 697
48 1147
60 1805
42 883
48 1154
45 1020
50 1272
27 378
51 1320
47 1122
50 1263
23 254
57 1624
32 514
38 724

output:

0 133119 200703 237567 262143 253951 245759 233471 204799 229375 221183 212991 198655 135167 172031 196607 188415 180223 167935 139263 163839 155647 147455 2492415 2559999 2596863 2621439 2613247 2605055 2592767 2564095 2588671 2580479 2572287 2557951 2494463 2531327 2555903 2547711 2539519 2527231 ...

result:

ok AC

Test #40:

score: 0
Accepted
time: 7ms
memory: 20760kb

input:

30
42 897
30 463
22 226
57 1647
38 735
59 1751
16 113
17 152
18 146
22 241
26 322
10 43
39 758
11 44
14 98
34 570
46 1057
26 338
19 163
58 1684
34 586
28 385
57 1645
11 36
56 1573
27 370
48 1160
32 498
24 295
28 402

output:

0 68853694463 103347650559 112206020607 117037858815 120259084287 119185342463 118111600639 116500987903 112742891519 115964116991 114890375167 113816633343 129385889791 134217727999 137438953471 136365211647 135291469823 133680857087 129922760703 133143986175 132070244351 130996502527 111937585151 ...

result:

ok AC

Test #41:

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

input:

30
41 834
57 1653
55 1512
29 413
12 66
54 1459
34 569
50 1249
34 590
21 203
58 1681
35 609
47 1118
11 59
10 29
50 1270
10 31
26 322
42 899
46 1059
18 171
35 613
27 363
33 541
55 1525
31 469
47 1098
42 879
46 1065
23 275

output:

0 1099645845503 1116959932415 1119375851519 1120986464255 1120449593343 1119912722431 1132260753407 1133871366143 1133334495231 1132797624319 1127965786111 1129576398847 1129039527935 1128502657023 1123670818815 1125281431551 1124744560639 1124207689727 1119107416063 1131992317951 1127697350655 1123...

result:

ok AC

Test #42:

score: 0
Accepted
time: 14ms
memory: 20756kb

input:

30
16 123
23 269
53 1421
42 887
60 1808
31 480
33 538
49 1225
35 609
59 1744
48 1150
52 1350
35 612
44 987
17 144
15 94
16 123
21 216
23 268
57 1633
23 273
28 406
54 1455
32 507
28 380
11 51
14 98
32 526
45 1022
53 1404

output:

0 16447 18559 19199 19455 20223 20479 19071 20095 18687 18943 22655 23295 23551 24319 24575 23167 24191 22783 23039 30847 31487 31743 32511 32767 31359 32383 30975 31231 18495 22591 30783 16511 17151 17407 18175 18431 17023 18047 16639 16895 49215 51327 51967 52223 52991 53247 51839 52863 51455 5171...

result:

ok AC

Test #43:

score: 0
Accepted
time: 7ms
memory: 20676kb

input:

30
28 393
40 819
56 1571
11 37
41 849
27 375
20 202
53 1430
56 1584
32 510
43 937
25 300
22 225
55 1529
11 42
18 151
17 126
36 662
13 91
60 1813
28 383
53 1418
60 1826
25 297
33 536
58 1683
14 102
47 1101
32 509
32 516

output:

0 67174399 75628543 76808191 77594623 77332479 77070335 83099647 83886079 83623935 83361791 81002495 81788927 81526783 81264639 78905343 79691775 79429631 79167487 76677119 82968575 80871423 78774271 75759615 76546047 76283903 76021759 125960191 127139839 127926271 127664127 127401983 133431295 1342...

result:

ok AC

Test #44:

score: 0
Accepted
time: 7ms
memory: 20672kb

input:

30
35 626
11 60
46 1053
47 1098
38 727
54 1455
27 363
40 814
29 412
19 169
49 1216
34 578
10 29
22 240
51 1312
57 1642
44 966
36 655
27 368
35 617
59 1747
53 1423
26 325
49 1209
34 574
11 45
53 1414
57 1645
35 606
40 814

output:

0 17181966335 25773998079 26851934207 27397193727 27682406399 27850178559 27917287423 27816624127 27715960831 27783069695 27665629183 27413970943 27581743103 27648851967 27548188671 27447525375 27514634239 27388805119 26860322815 27145535487 27313307647 27380416511 27279753215 27179089919 2724619878...

result:

ok AC

Test #45:

score: 0
Accepted
time: 4ms
memory: 20768kb

input:

30
60 1102
60 403
58 82
58 65
59 428
58 1173
58 626
58 1153
58 1448
59 1581
58 929
60 1019
58 530
60 1629
60 1546
60 824
59 3
58 1399
59 1165
60 417
59 1260
59 1310
58 1164
60 384
59 1325
58 131
60 1559
59 224
59 1489
60 1129

output:

0 576495936675512319 594545519557083135 595741788208103423 596445475649880063 596726950626590719 596304738161524735 595882525696458751 596164000673169407 607000787276529663 607704474718306303 607985949695016959 607563737229950975 607141524764884991 607422999741595647 611504386903900159 6122080743456...

result:

ok AC

Test #46:

score: 0
Accepted
time: 10ms
memory: 20760kb

input:

30
60 452
60 169
59 682
60 1006
60 1426
60 585
59 1368
60 1572
60 761
59 1113
59 1271
59 793
60 890
58 620
60 1774
58 285
60 1525
59 1277
58 861
60 515
60 1529
58 523
58 1129
59 917
60 1459
60 491
60 872
58 624
58 711
59 953

output:

0 576601489791778815 648799821318062079 685110093313736703 694680242521899007 700309742056112127 702561541869797375 699183842149269503 695806142428741631 698057942242426879 712694641031380991 718324140565594111 720575940379279359 717198240658751487 713820540938223615 716072340751908863 6941172925684...

result:

ok AC

Test #47:

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

input:

30
58 1370
59 14
60 79
59 1121
59 347
59 843
60 110
60 301
58 480
58 597
59 648
59 482
58 1169
60 340
58 681
59 1725
60 568
60 719
60 1327
59 577
60 380
58 882
58 934
58 1238
58 347
59 1007
59 143
60 1021
59 567
59 1572

output:

0 144119586122366975 216181578206806015 218442174113513471 219585666206400511 220183800531910655 220535644252798975 220676381741154303 220465275508621311 220254169276088319 220394906764443647 220148616159821823 219620850578489343 219972694299377663 220113431787732991 219902325555199999 2196912193226...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed