QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#354145#3054. Surface Area of CubesKevin5307AC ✓2ms4276kbC++20611b2024-03-14 22:29:102024-03-14 22:29:10

Judging History

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

  • [2024-03-14 22:29:10]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:4276kb
  • [2024-03-14 22:29:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	map<array<int,3>,int> Mp;
	int a,b,c;
	cin>>a>>b>>c;
	ll ans=2ll*a*b+2ll*b*c+2ll*a*c;
	int n;
	cin>>n;
	while(n--)
	{
		int x,y,z;
		cin>>x>>y>>z;
		for(int dx=-1;dx<=1;dx++)
		for(int dy=-1;dy<=1;dy++)
		for(int dz=-1;dz<=1;dz++) if(abs(dx)+abs(dy)+abs(dz)==1)
		{
			int nx=x+dx,ny=y+dy,nz=z+dz;
			if(nx<0||ny<0||nz<0||nx>=a||ny>=b||nz>=c||Mp[{nx,ny,nz}])
				ans--;
			else
				ans++;
		}
		Mp[{x,y,z}]=1;
	}
	cout<<ans<<endl;
	return 0;
}

詳細信息

Test #1:

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

input:

2 2 2 1
0 0 0

output:

24

result:

ok single line: '24'

Test #2:

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

input:

1 1 5 2
0 0 1
0 0 3

output:

18

result:

ok single line: '18'

Test #3:

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

input:

3 3 3 1
1 1 1

output:

60

result:

ok single line: '60'

Test #4:

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

input:

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

output:

474

result:

ok single line: '474'

Test #5:

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

input:

24 30 15 586
23 9 0
22 27 11
19 24 7
0 11 12
5 4 0
5 25 2
23 20 11
4 11 9
18 14 10
15 17 12
10 21 9
19 18 13
13 29 5
22 15 2
20 14 11
4 23 7
0 15 14
23 15 4
7 1 3
3 2 14
6 12 11
18 13 12
12 24 9
0 5 10
22 23 9
15 4 5
12 17 2
13 3 7
2 8 0
21 1 8
22 6 8
15 24 14
15 28 10
20 2 7
20 24 8
18 10 13
20 4 2...

output:

6010

result:

ok single line: '6010'

Test #6:

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

input:

15 36 7 893
12 9 0
10 12 2
0 22 4
3 18 6
0 23 0
0 32 2
0 14 6
4 21 6
0 2 6
11 5 0
11 15 0
3 0 0
2 17 0
8 0 5
5 16 5
12 20 0
1 27 2
1 28 1
10 10 2
11 22 4
14 0 1
2 28 2
13 6 2
9 0 5
11 32 5
7 1 4
4 12 4
5 15 3
11 24 2
3 16 4
13 29 2
11 16 4
12 28 1
14 30 6
10 8 2
14 10 6
5 34 5
14 35 1
14 33 6
5 13 1...

output:

5092

result:

ok single line: '5092'

Test #7:

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

input:

24 13 11 437
5 11 5
22 11 0
21 7 9
15 10 4
5 10 0
17 0 3
5 2 10
20 12 7
10 11 2
13 4 2
14 3 0
22 7 7
4 8 2
9 2 2
23 0 4
4 11 6
7 8 10
20 11 10
0 1 2
21 7 3
19 0 2
14 11 7
9 4 6
20 3 9
11 5 10
5 7 5
12 1 1
19 3 7
18 3 10
2 0 2
5 5 7
9 1 8
9 12 10
22 0 2
10 4 9
23 6 3
21 12 1
3 2 9
6 0 0
10 4 2
21 4 3...

output:

3402

result:

ok single line: '3402'

Test #8:

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

input:

3 9 27 317
2 8 19
2 8 11
1 0 16
2 7 10
1 5 11
2 3 22
2 7 7
2 3 18
2 0 19
1 1 22
2 0 11
1 0 5
1 6 26
0 0 11
1 5 13
1 0 19
0 8 18
2 0 24
2 0 8
2 6 0
2 7 1
2 8 17
1 4 11
1 3 24
2 2 2
1 7 23
0 6 15
2 7 5
0 6 13
0 2 1
1 3 19
1 7 17
1 2 4
1 4 0
1 8 20
0 7 13
1 7 0
1 3 15
1 6 14
0 0 10
0 2 4
0 0 23
1 6 20
...

output:

1322

result:

ok single line: '1322'

Test #9:

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

input:

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

output:

296

result:

ok single line: '296'

Test #10:

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

input:

20 27 14 776
2 1 6
12 19 10
0 0 8
18 6 10
14 6 10
13 9 10
9 5 9
4 12 2
2 0 5
11 17 13
14 11 11
2 9 11
17 25 11
12 1 1
2 18 2
19 17 1
9 10 1
6 12 1
5 16 11
11 16 9
6 5 8
13 2 7
15 5 3
9 21 5
18 7 11
11 6 11
2 24 11
4 14 1
17 13 8
15 11 6
10 11 1
4 26 4
0 14 4
13 17 4
17 8 1
13 6 3
2 16 9
9 10 9
18 18...

output:

6098

result:

ok single line: '6098'

Test #11:

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

input:

25 1 23 20
21 0 14
0 0 22
21 0 5
19 0 21
15 0 0
14 0 14
12 0 12
9 0 7
14 0 16
14 0 13
13 0 5
18 0 5
6 0 10
11 0 9
18 0 13
19 0 20
7 0 21
3 0 16
10 0 18
16 0 9

output:

1276

result:

ok single line: '1276'

Test #12:

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

input:

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

output:

3910

result:

ok single line: '3910'

Test #13:

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

input:

26 14 21 702
16 7 2
16 5 2
13 4 14
1 5 14
9 13 5
22 9 14
9 6 1
20 9 12
18 1 18
7 9 9
21 2 12
4 12 3
21 0 3
21 7 10
20 9 19
7 0 5
21 4 11
9 3 19
6 0 9
20 4 10
21 2 10
12 7 0
16 13 2
11 1 5
22 12 2
17 7 1
21 13 16
9 4 16
10 6 14
12 0 5
23 2 9
6 13 19
14 10 11
23 6 6
15 6 7
17 4 3
21 10 16
18 2 11
11 2...

output:

5874

result:

ok single line: '5874'

Test #14:

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

input:

28667886 39646791 377438 620
27429113 17963067 329712
27154146 17757924 133723
8102789 6107063 177140
23341468 23214079 364103
15503718 15791814 2941
26380687 19527765 145256
14114479 6401445 243881
26850631 34689805 49285
1550460 26537351 50875
2033937 22802527 41230
20374569 2336560 367960
8289367...

output:

2324748479426424

result:

ok single line: '2324748479426424'

Test #15:

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

input:

67734925 30898310 16601331 160
58087597 8468660 4215955
51714514 5650396 1390065
48502160 24201823 10757148
21398262 21473485 8113685
57185560 27549890 1359735
20460348 16020883 10052197
23837195 23969150 7612219
60703133 16055336 10180880
8322518 3479974 12084200
14075391 30273584 2894792
63619888 ...

output:

7460675384626030

result:

ok single line: '7460675384626030'

Test #16:

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

input:

9751936 87216224 64061743 747
8502913 85852357 17082553
523626 18255833 23111521
3560459 18255395 42006113
1559320 65259936 3663483
3272964 26873288 28885566
1255102 41866885 28948261
2604829 53214446 22255819
2185805 69888653 61394449
6011495 3194822 33673164
8540711 9765232 53658447
8981045 226243...

output:

14124952759429570

result:

ok single line: '14124952759429570'

Test #17:

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

input:

59234836 43958990 25937625 379
13801168 43950573 7637045
29544406 4648789 17546048
45901766 6476515 25722585
32272365 32327072 9809771
37535393 4469661 13258534
56199065 28931167 21835097
10151357 3027601 839913
31204878 15038747 10799300
11563808 8488550 10455312
24906316 27359271 13707465
32235171...

output:

10561012648960054

result:

ok single line: '10561012648960054'

Test #18:

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

input:

96102595 40367160 92402354 42
10631205 3108786 23969928
41436299 23478588 73174728
1541350 7537522 55537254
82783159 18153758 20915890
55949580 36787024 34914668
22206097 37566545 9429119
26284755 11937028 52348700
20394126 31694049 33056268
74850935 30905798 60644921
42083761 35427899 25838994
9093...

output:

32979030881167192

result:

ok single line: '32979030881167192'

Test #19:

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

input:

83598427 37713565 51026925 698
714952 31663154 15529983
6166641 37045439 27183685
5132166 15399176 32929223
1980428 29716716 30471106
80624786 20363515 44336586
78802787 33454302 38339350
82678757 14910506 28232810
64700064 33768805 37194542
26547751 37124853 35117232
11055318 8081232 18657163
77680...

output:

18685945255897898

result:

ok single line: '18685945255897898'

Test #20:

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

input:

48413254 56242807 61398986 517
31930882 11269173 58942074
474764 2850097 52463591
3272040 11939860 52590381
3297852 33611570 37617904
17004910 36676828 53797458
41187858 32309916 2211981
41970818 21418400 17523284
28703458 39409882 53119457
6006169 15836458 36557798
22512972 26737235 4500486
1633819...

output:

18297346650239350

result:

ok single line: '18297346650239350'

Test #21:

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

input:

39436599 30659573 85457174 257
4103666 27467717 36280528
35635501 6049776 49471015
27818289 9635000 80510361
30205539 24033062 22409611
29390558 2593030 67514443
35186606 12085471 6632782
32888186 14748648 13001028
33032610 14745606 40031675
17513559 9020815 57521258
37076939 18561983 1265288
495422...

output:

14398660106501852

result:

ok single line: '14398660106501852'

Test #22:

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

input:

56123507 4103699 72378069 69
54744646 2038155 50118188
48843564 2200526 44279959
47413726 869951 10667478
5176032 2898527 7241184
32228935 2113323 48427125
50971067 2722722 7770534
51366638 112577 14160079
3411590 177110 34714336
32281584 347074 51181976
28759198 2137814 65584145
19159918 2614547 17...

output:

9178885702195628

result:

ok single line: '9178885702195628'

Test #23:

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

input:

95812121 85311972 84188607 443
55469250 12216091 29577226
71112371 28202537 38167358
639290 81343414 16355716
3406678 19148355 39338093
93770949 80344523 77509219
51684048 5721353 66266523
39562538 75630707 13987758
54524632 80569125 76858839
83247180 7843958 79585269
43924547 32013919 62997804
5968...

output:

46845012135644784

result:

ok single line: '46845012135644784'

Test #24:

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

input:

9 11 5 472
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 1 0
0 1 1
0 1 2
0 1 3
0 1 4
0 2 0
0 2 1
0 2 2
0 2 3
0 2 4
0 3 0
0 3 1
0 3 2
0 3 3
0 3 4
0 4 0
0 4 1
0 4 2
0 4 3
0 4 4
0 5 0
0 5 1
0 5 2
0 5 3
0 5 4
0 6 0
0 6 1
0 6 2
0 6 3
0 6 4
0 7 0
0 7 1
0 7 2
0 7 3
0 7 4
0 8 0
0 8 1
0 8 2
0 8 3
0 8 4
0 9 0
0 9 1
0 9 2
0...

output:

132

result:

ok single line: '132'

Test #25:

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

input:

1 74 6 428
0 31 2
0 52 4
0 23 2
0 63 2
0 25 1
0 52 0
0 38 0
0 9 2
0 6 1
0 10 4
0 65 5
0 4 3
0 16 2
0 10 5
0 51 1
0 52 5
0 2 1
0 67 4
0 31 0
0 66 0
0 67 3
0 47 1
0 33 0
0 8 1
0 39 0
0 29 0
0 4 2
0 6 4
0 60 0
0 52 2
0 17 3
0 0 1
0 50 3
0 49 5
0 44 3
0 33 5
0 26 0
0 66 4
0 8 4
0 22 2
0 18 2
0 3 3
0 26 ...

output:

94

result:

ok single line: '94'

Test #26:

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

input:

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

output:

76

result:

ok single line: '76'

Test #27:

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

input:

281 2 1 538
47 0 0
42 0 0
258 0 0
187 1 0
89 1 0
254 1 0
39 1 0
280 0 0
55 0 0
273 1 0
98 0 0
147 1 0
102 0 0
263 1 0
10 1 0
98 1 0
229 1 0
186 0 0
196 0 0
29 1 0
259 0 0
128 1 0
198 1 0
129 0 0
4 0 0
108 0 0
25 0 0
276 0 0
83 1 0
154 0 0
222 0 0
53 0 0
66 1 0
245 0 0
68 0 0
84 1 0
224 1 0
242 0 0
2...

output:

140

result:

ok single line: '140'

Test #28:

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

input:

29 2 14 781
0 0 0
0 0 1
0 0 2
0 0 3
0 0 4
0 0 5
0 0 6
0 0 7
0 0 8
0 0 9
0 0 10
0 0 11
0 0 12
0 0 13
0 1 0
0 1 1
0 1 2
0 1 3
0 1 4
0 1 5
0 1 6
0 1 7
0 1 8
0 1 9
0 1 10
0 1 11
0 1 12
0 1 13
1 0 0
1 0 1
1 0 2
1 0 3
1 0 4
1 0 5
1 0 6
1 0 7
1 0 8
1 0 9
1 0 10
1 0 11
1 0 12
1 0 13
1 1 0
1 1 1
1 1 2
1 1 3
...

output:

184

result:

ok single line: '184'

Test #29:

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

input:

162 2 1 315
66 0 0
75 1 0
84 0 0
72 0 0
11 1 0
60 1 0
60 0 0
1 1 0
45 0 0
129 1 0
118 0 0
24 1 0
5 0 0
122 1 0
38 1 0
55 0 0
158 0 0
130 1 0
48 0 0
108 1 0
133 1 0
118 1 0
157 1 0
79 1 0
97 0 0
156 1 0
155 1 0
13 0 0
75 0 0
123 0 0
28 1 0
15 0 0
64 0 0
120 0 0
26 0 0
98 0 0
34 0 0
109 0 0
28 0 0
104...

output:

54

result:

ok single line: '54'

Test #30:

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

input:

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

output:

72

result:

ok single line: '72'

Test #31:

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

input:

2 81 3 440
1 29 0
1 22 0
1 20 2
0 72 2
1 41 0
0 73 1
1 69 0
0 18 1
1 21 1
1 47 2
1 79 1
1 78 0
0 71 1
1 24 1
1 27 1
0 47 2
0 45 0
1 53 0
1 31 1
0 38 2
1 68 1
1 71 1
0 75 0
1 7 1
0 4 2
0 30 0
0 29 0
0 69 1
1 44 0
0 77 0
1 8 2
1 56 2
1 6 1
0 56 2
0 67 1
1 61 2
0 16 1
1 38 1
1 20 0
1 61 1
1 27 2
1 2 1
...

output:

256

result:

ok single line: '256'

Test #32:

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

input:

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

output:

220

result:

ok single line: '220'

Test #33:

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

input:

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

output:

256

result:

ok single line: '256'

Test #34:

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

input:

2285 4 1324 588
1035 3 137
1035 3 136
1035 3 135
1035 2 135
1035 1 135
1035 1 136
1036 1 136
1036 2 136
1035 2 136
1034 2 136
1033 2 136
1032 2 136
1032 3 136
1032 3 137
1032 2 137
1032 2 138
1032 1 138
1032 1 137
1032 1 136
1032 1 135
1032 0 135
1032 0 134
1032 0 133
1032 0 132
1032 0 131
1033 0 13...

output:

6080854

result:

ok single line: '6080854'

Test #35:

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

input:

3756 217624 9758220 553
1163 140758 4576409
1181 140759 4576410
1188 140764 4576406
1190 140768 4576409
1192 140765 4576411
1191 140763 4576416
1160 140747 4576399
1171 140755 4576411
1184 140759 4576404
1161 140754 4576399
1176 140753 4576410
1195 140768 4576413
1195 140768 4576414
1178 140752 4576...

output:

4322184280504

result:

ok single line: '4322184280504'

Test #36:

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

input:

62122975 1530 4 477
46593107 324 2
46593108 324 2
46593108 324 3
46593108 325 3
46593108 326 3
46593108 326 2
46593108 327 2
46593108 328 2
46593108 328 1
46593109 328 1
46593110 328 1
46593111 328 1
46593112 328 1
46593112 328 0
46593113 328 0
46593113 327 0
46593113 326 0
46593113 325 0
46593113 3...

output:

190593300680

result:

ok single line: '190593300680'

Test #37:

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

input:

80 12 2248 766
55 1 1195
62 10 1199
59 2 1201
70 8 1224
16 9 1197
63 2 1219
73 11 1222
63 0 1213
55 11 1201
26 7 1197
16 6 1192
56 6 1200
68 9 1228
69 11 1224
62 1 1217
26 8 1197
37 7 1183
56 3 1191
66 5 1221
62 11 1200
69 10 1224
58 0 1197
27 10 1185
70 10 1226
61 8 1199
58 0 1198
35 11 1181
58 3 1...

output:

417790

result:

ok single line: '417790'

Test #38:

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

input:

8756292 705 91748680 893
7471743 49 28476456
7471743 50 28476456
7471743 50 28476455
7471744 50 28476455
7471744 50 28476456
7471744 51 28476456
7471743 51 28476456
7471743 52 28476456
7471742 52 28476456
7471742 53 28476456
7471741 53 28476456
7471741 53 28476455
7471742 53 28476455
7471742 54 2847...

output:

1606898177402594

result:

ok single line: '1606898177402594'

Test #39:

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

input:

25527712 11611 8085 601
17982017 9899 906
17982009 9897 890
17982019 9894 888
17982011 9897 887
17982017 9888 886
17982020 9909 903
17982018 9881 881
17982007 9889 889
17982020 9908 900
17982020 9876 882
17982028 9891 883
17982002 9893 894
17982023 9882 875
17982022 9880 873
17982001 9896 898
179820...

output:

1005775383020

result:

ok single line: '1005775383020'

Test #40:

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

input:

548 9143 2119298 382
402 2107 239547
402 2108 239547
402 2108 239546
402 2107 239546
403 2107 239546
403 2106 239546
403 2105 239546
404 2105 239546
404 2105 239545
404 2105 239544
404 2105 239543
404 2105 239542
404 2105 239541
403 2105 239541
403 2104 239541
403 2103 239541
402 2103 239541
402 210...

output:

41086255794

result:

ok single line: '41086255794'

Test #41:

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

input:

265169 2404 23 590
103100 1812 16
103104 1815 4
103091 1803 19
103097 1807 16
103102 1814 14
103101 1808 19
103102 1812 19
103093 1798 5
103102 1814 16
103091 1803 18
103092 1794 6
103102 1813 14
103098 1798 8
103107 1807 21
103101 1809 15
103096 1808 14
103104 1815 5
103090 1796 4
103096 1794 10
10...

output:

1287242778

result:

ok single line: '1287242778'

Test #42:

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

input:

3946 90293 466076 228
2650 60982 357600
2650 60981 357600
2650 60980 357600
2650 60979 357600
2651 60979 357600
2651 60980 357600
2651 60980 357599
2651 60980 357598
2650 60980 357598
2649 60980 357598
2649 60980 357599
2649 60980 357600
2648 60980 357600
2648 60980 357601
2648 60981 357601
2648 609...

output:

88557665434

result:

ok single line: '88557665434'

Test #43:

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

input:

6 2186 27208 850
0 966 23589
2 975 23587
0 965 23589
1 992 23581
5 990 23589
1 970 23599
3 959 23591
4 1013 23603
2 963 23585
3 994 23574
2 973 23595
3 973 23599
0 996 23574
3 972 23600
0 985 23582
3 1015 23599
1 968 23585
3 970 23600
1 1013 23604
3 1001 23593
5 978 23587
4 988 23587
4 967 23592
5 9...

output:

119308296

result:

ok single line: '119308296'

Test #44:

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

input:

80038898 33687266 40057171 1000
73546054 5183591 25712189
71556808 3827094 4486092
32881620 2414547 6685780
44201803 1148714 11100879
65559678 33211271 12153539
8305315 14573231 20324621
76997603 1772718 22034111
64985824 23967308 11979305
69881177 26657747 24072691
6320139 21483706 15255988
5018248...

output:

14503680091595824

result:

ok single line: '14503680091595824'

Test #45:

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

input:

85063054 64734177 23850286 1000
26288073 56281180 22492205
36603010 57199100 16735694
4770194 43757289 19327903
62716276 12158667 13300351
33837057 41938225 9728351
65466168 42804394 9167732
32496174 36678874 19452621
43538443 19093259 3153876
42388832 42838136 4233924
45240089 24856191 8016663
3125...

output:

18158387190315248

result:

ok single line: '18158387190315248'

Test #46:

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

input:

42752134 43411323 27671021 1000
31456804 20300404 17715411
4204812 40184795 21200926
29433805 6987973 12525876
8021934 35386072 26034100
36534039 12794952 23988434
18633792 42671296 22810760
28721456 26698073 23296493
25300090 36454036 16744398
22886097 22951356 18302556
27095821 40017509 12510582
3...

output:

8480315052191758

result:

ok single line: '8480315052191758'

Test #47:

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

input:

35834842 21341705 43706034 1000
6844311 5494660 35679040
12771429 246805 5783139
7260534 1127765 16682641
3596699 2805614 38954272
4876316 7927005 33188924
10391400 18175843 33826201
25384818 19985792 10740826
23730020 13492449 22389451
1716409 2916509 6608750
32531877 14814024 43196379
8939778 8535...

output:

6527473467746416

result:

ok single line: '6527473467746416'

Test #48:

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

input:

22166331 22464325 11540679 1000
4311478 13397674 8278276
12229724 10677456 9790564
14175583 13676486 268641
15943354 11174416 5773340
15015223 7178983 7036510
11945108 18622095 5961068
2609879 6274141 7829187
11692110 20137759 810939
8017347 2507499 4560094
109698 15808953 6483838
18771551 16645735 ...

output:

2026039476199998

result:

ok single line: '2026039476199998'

Test #49:

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

input:

1 1 3 1
0 0 1

output:

12

result:

ok single line: '12'

Test #50:

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

input:

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

output:

20

result:

ok single line: '20'

Test #51:

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

input:

1 2 1 1
0 0 0

output:

6

result:

ok single line: '6'

Test #52:

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

input:

2 2 2 2
1 1 0
0 0 0

output:

24

result:

ok single line: '24'

Test #53:

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

input:

1 3 2 2
0 2 1
0 1 0

output:

20

result:

ok single line: '20'

Test #54:

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

input:

9115 1 9 175
1966 0 6
6140 0 4
8872 0 2
3792 0 5
566 0 6
4973 0 7
8289 0 4
3625 0 2
2351 0 8
3723 0 2
4916 0 8
8244 0 7
8930 0 0
4339 0 6
3693 0 2
4688 0 5
5756 0 4
5148 0 4
5265 0 8
866 0 6
7700 0 7
7683 0 2
5777 0 5
4507 0 4
4705 0 3
1355 0 6
7217 0 7
2859 0 8
718 0 8
3682 0 8
4934 0 1
2188 0 2
33...

output:

182586

result:

ok single line: '182586'

Test #55:

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

input:

1 28231799 160 96
0 6417269 80
0 19178153 139
0 4634832 100
0 15828821 57
0 12421318 138
0 11503221 57
0 26689773 83
0 9218657 125
0 20857243 4
0 21321829 143
0 17085471 80
0 25857401 106
0 8190882 119
0 433687 124
0 18623265 94
0 26690519 81
0 21460018 113
0 17890646 57
0 16137770 79
0 26928963 51
...

output:

9090639788

result:

ok single line: '9090639788'

Test #56:

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

input:

336 2 1 633
323 1 0
54 0 0
305 0 0
197 1 0
77 1 0
135 0 0
289 0 0
299 1 0
45 0 0
87 1 0
150 0 0
89 1 0
88 1 0
38 0 0
147 1 0
126 1 0
40 0 0
153 1 0
92 1 0
8 0 0
60 1 0
274 0 0
334 0 0
239 0 0
203 0 0
109 0 0
52 0 0
307 1 0
225 1 0
231 0 0
107 0 0
43 0 0
219 1 0
140 1 0
269 1 0
198 0 0
96 0 0
124 0 0...

output:

228

result:

ok single line: '228'

Test #57:

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

input:

70798492 3946807 1 967
23623152 3265949 0
5373956 2041836 0
8234846 362168 0
3284937 1490834 0
1952773 3339718 0
70542392 3448066 0
14102047 581093 0
42821477 701949 0
9140348 1035772 0
36747479 3792297 0
53135697 3627880 0
61944291 3169645 0
31410036 1975846 0
51090195 1549805 0
24074127 953531 0
1...

output:

558856117122620

result:

ok single line: '558856117122620'

Test #58:

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

input:

3142 19538 1 507
1602 5355 0
1182 2260 0
660 19459 0
1371 10316 0
1026 10034 0
781 600 0
2231 6478 0
710 13807 0
381 14383 0
2772 631 0
562 1503 0
892 4577 0
2319 13490 0
1155 14566 0
1826 11800 0
2533 3979 0
2681 16836 0
2848 2009 0
429 18517 0
2255 184 0
1838 6728 0
2038 12435 0
38 10658 0
2767 13...

output:

122823166

result:

ok single line: '122823166'

Test #59:

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

input:

1 752229 1 101
0 542577 0
0 140801 0
0 174016 0
0 646883 0
0 73233 0
0 93134 0
0 2804 0
0 556856 0
0 235262 0
0 368043 0
0 385610 0
0 686152 0
0 389156 0
0 472117 0
0 33749 0
0 208233 0
0 314621 0
0 501959 0
0 468594 0
0 638892 0
0 610144 0
0 505231 0
0 6822 0
0 351067 0
0 619553 0
0 400263 0
0 6297...

output:

3008716

result:

ok single line: '3008716'

Test #60:

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

input:

1 1 57578 225
0 0 47106
0 0 11312
0 0 39195
0 0 52858
0 0 41204
0 0 28678
0 0 3450
0 0 14808
0 0 45531
0 0 38738
0 0 2686
0 0 25330
0 0 57497
0 0 5270
0 0 54295
0 0 51906
0 0 17172
0 0 42383
0 0 10913
0 0 36085
0 0 43077
0 0 57127
0 0 32671
0 0 53341
0 0 50813
0 0 57568
0 0 18342
0 0 3169
0 0 37380
...

output:

229860

result:

ok single line: '229860'

Test #61:

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

input:

1 16 1 6
0 8 0
0 12 0
0 2 0
0 7 0
0 0 0
0 5 0

output:

50

result:

ok single line: '50'

Test #62:

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

input:

1 1 445 442
0 0 410
0 0 254
0 0 7
0 0 166
0 0 302
0 0 245
0 0 12
0 0 41
0 0 297
0 0 111
0 0 80
0 0 179
0 0 333
0 0 295
0 0 151
0 0 9
0 0 42
0 0 265
0 0 2
0 0 77
0 0 396
0 0 183
0 0 327
0 0 170
0 0 92
0 0 235
0 0 182
0 0 48
0 0 167
0 0 300
0 0 222
0 0 440
0 0 45
0 0 385
0 0 180
0 0 424
0 0 36
0 0 335...

output:

18

result:

ok single line: '18'

Test #63:

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

input:

4 1 1 1
2 0 0

output:

16

result:

ok single line: '16'

Test #64:

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

input:

371 46471091 508491 0

output:

47295121917206

result:

ok single line: '47295121917206'

Test #65:

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

input:

4473 74 215814 0

output:

1963274520

result:

ok single line: '1963274520'

Test #66:

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

input:

108 88935 5 0

output:

20100390

result:

ok single line: '20100390'

Test #67:

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

input:

5 5 5 7
2 2 3
2 3 2
2 2 1
2 1 2
1 2 2
3 2 2
2 2 2

output:

180

result:

ok single line: '180'

Test #68:

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

input:

1 3 3 1
0 1 1

output:

32

result:

ok single line: '32'