Submission details
Task:Kaaleppi's run
Sender:🍦🍧🍨
Submission time:2015-10-07 17:57:18 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1--details
#2--details
#3--details
#4--details
#5--details
#6--details
#7--details
#8--details
#9--details
#10--details
#11--details
#12--details
#13--details
#14--details
#15--details
#16--details
#17ACCEPTED0.11 sdetails
#18--details
#19ACCEPTED0.58 sdetails
#20--details
#21--details
#22--details
#23--details
#24--details
#25ACCEPTED0.53 sdetails
#26--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:5:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
                        ^
input/code.cpp:6:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int q; scanf("%d", &q);
                        ^
input/code.cpp:11:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%ld", &build[i+1]);
                            ^
input/code.cpp:19:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &type);
                     ^
input/code.cpp:22:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(...

Code

#include <cstdio>

int main(){
	
	int n; scanf("%d", &n);
	int q; scanf("%d", &q);
	long build[n+1];
	long damage[n+1];
	
	for(int i=0; i<n; i++){
		scanf("%ld", &build[i+1]);
		damage[i+1] = 1;
	}

	int type;
	int start, end;
	long  div, sum;
	for(int i=0; i<q; i++){
		scanf("%d", &type);
		if(type == 1){
			//kaaleppis run
			scanf("%d", &start);
			scanf("%d", &end);
			scanf("%ld", &div);
			//io.println(type + " " + start + " " + end + " " + div);
			for (int j=start; j<=end; j++){
				damage[j] *= div;
			}
		}else if(type == 2){
			//calculate
			scanf("%d", &start);
			scanf("%d", &end);
			sum   = 0;
			//io.println(type + " " + start + " " + end);
			for (int j=start; j<=end; j++){
				build[j] /= damage[j];
				sum += build[j];
				damage[j] = 1;
			}
			printf("%ld\n", sum);
		}
	}
}

Test details

Test 1

Verdict:

input
89384 30887
181692778 214636916 457747794 ...

correct output
1804050627345
17190852410312
411502775169
3113342279558
8333256205719
...

user output
(empty)

Test 2

Verdict:

input
100000 100000
998266605 915356779 912790314 ...

correct output
29417725507852
14069958902518
32492521827682
31832717878177
37392525322930
...

user output
(empty)

Test 3

Verdict:

input
24122 27210
720061051 117808492 692602066 ...

correct output
7905321835848
74654045954
13860983362
4552411285636
5115859291028
...

user output
(empty)

Test 4

Verdict:

input
100000 100000
102456186 211809187 35621161 1...

correct output
476972448791
8762758932570
2979574911173
8848393143208
11201331362593
...

user output
(empty)

Test 5

Verdict:

input
74786 9226
918714475 903414035 948693630 ...

correct output
118159187091
6996521712481
343846964037
4475890270989
39029198966713
...

user output
(empty)

Test 6

Verdict:

input
100000 100000
368024829 622860480 273973275 ...

correct output
23379963833
828312683899
249586087312
976550848102
2587363001198
...

user output
(empty)

Test 7

Verdict:

input
35007 79094
12035224 114002544 235286797 1...

correct output
204271464659
5909638630640
4687591847301
3066690904638
1885548750877
...

user output
(empty)

Test 8

Verdict:

input
100000 100000
969999171 968505211 979179536 ...

correct output
34382832187404
19996527151566
8737512722051
34379137588533
3849378746164
...

user output
(empty)

Test 9

Verdict:

input
87818 28256
936732551 480097841 121490043 ...

correct output
24274034300818
4808738610821
16196066101086
20772993127415
12778141750322
...

user output
(empty)

Test 10

Verdict:

input
100000 100000
118924185 479129421 233811855 ...

correct output
2105953517389
7342886509324
5998536240940
14161173055
27211552156
...

user output
(empty)

Test 11

Verdict:

input
32686 83319
955342582 977631132 921703016 ...

correct output
98639917872
5569139432406
2084121497706
10744709043244
4788263308974
...

user output
(empty)

Test 12

Verdict:

input
100000 100000
64003093 313774499 472813823 2...

correct output
14709899970794
1374895224012
2157212443656
24762328538895
104184379815
...

user output
(empty)

Test 13

Verdict:

input
77464 96311
245526869 136701619 410116807 ...

correct output
252601407670
2131853683612
2478288401924
57103316362
471636293224
...

user output
(empty)

Test 14

Verdict:

input
100000 100000
978002610 906758535 922616061 ...

correct output
750821231983
9472146426585
45965549114229
857319204389
39311833581115
...

user output
(empty)

Test 15

Verdict:

input
91524 83526
448052880 43627002 543256376 8...

correct output
21830130401884
6130391249322
4479948741423
1156787203844
1770042502857
...

user output
(empty)

Test 16

Verdict:

input
100000 100000
369083379 64675887 215444862 4...

correct output
13149405144679
1934207579619
280287979191
6624064900640
3354929365868
...

user output
(empty)

Test 17

Verdict: ACCEPTED

input
2535 20317
943487462 968597685 908094828 ...

correct output
210
2230
0
0
1506
...

user output
210
2230
0
0
1506
...

Test 18

Verdict:

input
100000 100000
699277338 181982107 347572115 ...

correct output
5081
238
1248
9497678092829
2730159531070
...

user output
(empty)

Test 19

Verdict: ACCEPTED

input
10741 36991
279840985 153592091 34619136 3...

correct output
0
35481651536
0
164
0
...

user output
0
35481651536
0
164
0
...

Test 20

Verdict:

input
100000 100000
969884975 926876543 922487465 ...

correct output
24727549984135
19116904097472
38181121396118
39692078145581
5194513719544
...

user output
(empty)

Test 21

Verdict:

input
32021 18275
256391370 728513016 69454866 2...

correct output
6890043962809
462921344703
7548279997930
2584402654875
958203954614
...

user output
(empty)

Test 22

Verdict:

input
100000 100000
283379729 284392423 234448219 ...

correct output
91137168850
15604682642039
1661408937911
5640081095415
311200637380
...

user output
(empty)

Test 23

Verdict:

input
70663 87083
925944238 971626023 956954867 ...

correct output
1646606757175
3452121863310
3379964614795
21711497276426
4955910750438
...

user output
(empty)

Test 24

Verdict:

input
100000 100000
294515 554986201 276123701 120...

correct output
3141624879301
13845159613234
32013375153347
6164048700755
4699478558553
...

user output
(empty)

Test 25

Verdict: ACCEPTED

input
3122 77157
174959604 88740117 137985864 2...

correct output
155542227140
27992279647
8996233987
149087477657
36086043726
...

user output
155542227140
27992279647
8996233987
149087477657
36086043726
...

Test 26

Verdict:

input
100000 100000
904289365 946930878 981692761 ...

correct output
43685168304962
86518215653219
7290086324818
10572290153245
18779591179839
...

user output
(empty)