QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#115458#6630. Triangle CollectionMr_Eight#10 133ms16464kbC++143.0kb2023-06-26 09:48:322024-05-31 14:13:36

Judging History

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

  • [2024-05-31 14:13:36]
  • 评测
  • 测评结果:10
  • 用时:133ms
  • 内存:16464kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-26 09:48:32]
  • 提交

answer

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
#define vi vector<int>
#define ull unsigned long long
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
#define mid ((l+r)>>1)
int n,q,c[200002];
ll mmax[800002],tag[800002],sum;
inline void pushdown(int pos){
	if(tag[pos]){
		tag[pos<<1]+=tag[pos],tag[pos<<1|1]+=tag[pos];
		mmax[pos<<1]+=tag[pos],mmax[pos<<1|1]+=tag[pos];
		tag[pos]=0;
	}
}
inline void add(int pos,int l,int r,int ql,int qr,int v){
	if(ql<=l&&qr>=r){
		tag[pos]+=v,mmax[pos]+=v;
		return;
	}
	pushdown(pos);
	if(ql<=mid)add(pos<<1,l,mid,ql,qr,v);
	if(qr>mid)add(pos<<1|1,mid+1,r,ql,qr,v);
	mmax[pos]=max(mmax[pos<<1],mmax[pos<<1|1]);
}
inline void add(int pos,int v){
	if(v&1)add(1,1,n,(pos+2)>>1,n,-1);
	add(1,1,n,pos,n,v>>1),sum+=(v>>1);
	c[pos]=v;
}
inline void mns(int pos,int v){
	if(v&1)add(1,1,n,(pos+2)>>1,n,1);
	add(1,1,n,pos,n,-(v>>1)),sum-=(v>>1);
	c[pos]=v;
}
int main() {
	cin>>n>>q;
	F(i,1,n){
		add(i,read());
	}
	F(asdf,1,q){
		int pos=read(),d=read();
		mns(pos,c[pos]);
		add(pos,c[pos]+d);
		int ans=max(mmax[1],0ll);
		write(sum-(ans+2)/3,'\n');
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

1 23
1485
1 -12
1 -30
1 -20
1 6
1 24
1 5
1 31
1 14
1 -34
1 -22
1 -45
1 37
1 46
1 9
1 22
1 -9
1 9
1 -46
1 -47
1 39
1 36
1 -36
1 50

output:

491
481
474
476
484
486
496
501
489
482
467
479
495
498
505
502
505
490
474
487
499
487
504

result:

ok 23 numbers

Test #2:

score: 5
Accepted
time: 1ms
memory: 3668kb

input:

12 1
13 79 59 21 32 13 85 40 74 15 49 56
3 31

output:

189

result:

ok 1 number(s): "189"

Test #3:

score: 5
Accepted
time: 1ms
memory: 5628kb

input:

50 1995
3 2 3 0 3 0 5 2 2 2 3 0 4 5 4 4 3 0 1 0 5 5 3 4 3 3 1 1 4 5 5 4 1 1 3 1 4 2 1 3 4 1 5 5 0 3 0 3 4 3
49 1
48 -2
45 3
49 0
31 -4
13 0
15 -2
48 0
38 -2
8 0
48 3
12 1
22 -4
7 -5
5 -1
3 1
15 -2
37 -4
39 -1
24 -2
11 2
35 -2
17 -1
41 -2
20 5
8 0
18 0
26 -3
25 -3
49 -5
31 4
46 -2
38 0
42 3
16 -4
5 3...

output:

44
44
45
45
43
43
43
43
42
42
43
43
42
40
40
40
40
38
38
37
38
37
37
36
38
38
38
37
36
34
36
35
35
36
35
36
36
37
36
37
37
38
38
38
39
38
37
36
36
35
36
36
36
36
35
35
35
35
33
35
35
34
34
33
34
35
36
36
35
35
37
36
36
36
35
35
35
35
35
36
37
37
37
36
37
36
38
38
38
39
39
38
38
38
37
39
39
41
40
40
...

result:

ok 1995 numbers

Test #4:

score: 5
Accepted
time: 1ms
memory: 5792kb

input:

50 1996
0 1 0 1 2 2 4 1 3 2 5 3 4 1 5 5 1 2 0 2 1 2 5 4 3 1 4 5 1 2 3 5 5 1 4 4 2 3 5 3 1 3 2 3 3 0 4 2 5 0
29 4
50 3
30 2
6 0
26 -1
13 -2
34 1
5 2
23 -5
45 1
30 -4
17 3
40 1
49 -5
24 -1
35 -2
12 -2
30 1
3 0
5 -3
38 0
14 -1
38 2
25 -3
25 0
26 2
20 1
24 2
43 1
27 -2
38 -2
12 3
43 1
4 3
13 1
25 2
26 -...

output:

44
45
46
46
46
45
45
46
44
45
43
44
45
43
43
42
41
42
42
41
41
40
41
40
40
41
41
42
42
41
41
42
42
43
43
44
44
44
44
45
45
46
47
47
47
46
46
44
44
44
44
44
44
44
43
43
42
41
41
42
43
43
45
45
45
45
45
45
45
44
43
44
44
44
45
44
45
46
45
44
43
43
43
43
43
44
44
44
46
45
43
44
44
44
43
44
45
44
44
44
...

result:

ok 1996 numbers

Test #5:

score: 5
Accepted
time: 1ms
memory: 5640kb

input:

50 1997
39 35 37 37 36 36 38 37 36 36 37 40 37 39 40 37 38 35 36 36 37 36 40 36 40 37 40 37 37 38 39 35 40 36 38 40 35 36 39 38 38 37 35 37 36 37 36 36 36 37
3 0
13 3
33 -3
24 2
25 0
9 3
18 2
11 0
28 2
39 -2
9 -2
5 -1
2 0
25 -3
25 3
47 1
10 4
34 2
8 -1
32 0
47 -2
17 -2
20 0
3 3
39 3
1 -4
18 2
35 0
3...

output:

620
621
620
621
621
622
622
622
623
622
622
621
621
620
621
622
623
624
623
623
623
622
622
623
624
623
623
623
622
622
623
623
624
624
624
625
624
623
622
621
620
619
618
617
615
616
617
617
618
616
616
617
616
616
616
617
619
618
617
617
617
618
619
618
619
618
619
620
619
619
620
621
620
620
621
...

result:

ok 1997 numbers

Test #6:

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

input:

2000 2000
2 1 2 1 4 1 5 1 0 0 1 2 0 2 2 0 2 1 0 0 1 0 1 1 1 0 4 1 0 0 5 2 1 0 1 6 0 0 1 1 1 0 0 0 0 1 1 0 0 2 0 0 1 1 0 1 1 1 0 0 1 0 3 0 0 0 2 1 0 1 2 0 0 3 2 1 0 0 0 0 1 1 0 1 2 0 0 0 0 0 2 3 0 2 0 4 0 1 2 0 0 0 1 0 1 5 0 0 0 4 0 0 1 2 3 0 1 0 1 0 1 0 2 0 1 0 1 2 1 1 2 1 0 2 0 0 0 2 3 6 1 0 0 0 1 ...

output:

649
649
649
649
649
649
649
649
648
648
649
649
649
649
649
649
649
650
650
650
650
650
650
650
650
649
650
650
649
650
650
650
650
650
650
650
650
649
649
649
649
648
650
650
650
650
650
650
649
649
649
649
650
650
650
650
650
650
650
650
650
651
651
651
651
651
651
651
651
651
651
651
650
652
652
...

result:

ok 2000 numbers

Test #7:

score: 5
Accepted
time: 1ms
memory: 5776kb

input:

2000 2000
0 1 3 1 1 4 0 0 1 0 1 0 0 0 1 0 0 1 0 2 1 0 0 4 0 0 1 0 0 2 0 0 0 0 1 0 2 1 0 1 0 2 0 5 0 0 1 0 2 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 4 3 0 0 1 1 0 0 3 0 0 0 0 1 8 0 0 0 0 2 0 0 0 0 0 0 0 0 2 0 0 2 0 0 0 0 3 2 0 1 1 4 2 4 2 2 0 3 0 1 0 0 3 0 3 0 0 0 5 1 0 0 0 0 2 1 1 0 1 1 1 0 0 5 2 4 0 0 0 1 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
664
666
666
666
666
666
666
666
666
665
665
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
...

result:

ok 2000 numbers

Test #8:

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

input:

1000 2000
2 8 1 1 4 1 1 1 2 1 1 2 1 2 1 3 1 1 3 2 1 2 2 1 2 2 2 3 5 1 1 2 1 5 4 1 1 1 2 1 1 1 1 2 2 1 1 2 1 1 2 2 4 2 1 4 2 1 1 2 5 1 4 2 3 1 4 4 1 1 2 1 1 2 2 1 1 1 2 1 1 2 3 2 1 1 2 1 1 1 1 1 1 1 1 3 1 2 1 2 1 1 1 1 2 1 4 3 2 1 3 1 6 4 1 2 2 3 1 2 5 1 1 3 3 2 2 1 2 1 1 2 3 6 1 1 3 2 2 1 2 3 1 2 1 ...

output:

660
660
660
660
659
659
658
659
659
659
659
659
659
659
660
660
660
659
658
658
659
659
659
659
657
658
659
659
658
657
656
657
658
658
658
657
656
656
657
657
657
657
657
657
656
657
656
655
656
656
656
657
657
657
655
655
656
656
657
657
657
657
657
657
656
657
655
653
655
654
655
656
655
654
655
...

result:

ok 2000 numbers

Test #9:

score: 5
Accepted
time: 2ms
memory: 5772kb

input:

2000 2000
1 2 0 2 2 0 2 0 2 0 1 1 1 0 1 1 1 1 1 2 0 1 0 2 0 1 2 1 1 2 0 2 2 1 1 0 0 2 0 1 1 1 2 2 2 2 2 0 2 2 1 0 1 2 2 0 1 2 2 2 0 0 0 1 0 0 1 1 1 1 1 1 1 2 0 0 0 0 2 1 1 1 2 0 1 2 1 2 0 1 0 2 2 1 2 1 0 2 2 1 0 0 0 2 0 1 0 1 1 1 0 0 1 0 0 2 2 2 0 2 2 0 0 1 2 2 0 1 0 1 1 1 1 1 0 2 2 1 1 0 1 0 1 2 1 ...

output:

652
652
652
652
652
652
653
653
653
653
653
653
653
653
654
655
655
655
654
655
654
653
653
654
653
654
655
654
654
653
653
652
653
654
654
655
656
656
655
654
654
654
655
655
655
656
657
657
657
657
657
657
658
659
659
660
661
660
661
660
660
660
659
659
658
657
656
657
657
657
656
656
656
656
657
...

result:

ok 2000 numbers

Test #10:

score: 5
Accepted
time: 2ms
memory: 5796kb

input:

2000 2000
0 3 0 0 2 1 0 0 0 0 1 0 1 0 5 0 0 0 2 5 2 0 0 3 1 0 3 2 0 0 3 0 1 0 4 0 1 0 0 2 2 0 0 0 3 0 0 0 0 2 3 1 0 1 1 0 7 3 1 1 2 0 0 0 0 0 2 0 1 0 0 0 1 0 0 1 2 0 2 1 1 0 2 0 0 0 1 0 0 0 0 0 1 0 0 2 0 0 0 0 1 1 1 1 1 0 0 2 0 5 2 0 1 0 5 1 2 3 2 1 0 0 0 1 1 0 0 0 1 2 1 0 1 1 0 0 0 0 2 0 3 0 1 2 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
665
664
665
665
665
664
664
664
664
664
663
664
663
663
662
662
662
662
662
662
662
662
662
662
662
662
661
661
661
661
661
661
660
660
660
660
660
661
661
661
661
661
661
662
662
662
661
660
660
...

result:

ok 2000 numbers

Test #11:

score: 5
Accepted
time: 1ms
memory: 3796kb

input:

2000 2000
0 2 0 1 0 2 1 0 0 0 0 0 2 1 2 0 0 0 0 0 0 0 0 1 0 0 1 1 4 2 0 0 2 0 1 0 3 1 2 1 0 1 1 2 0 2 0 1 0 0 0 1 0 1 0 1 2 0 0 0 0 0 0 2 2 0 0 0 2 0 1 2 4 0 0 0 0 5 0 1 3 1 2 1 3 0 2 4 0 2 1 2 1 0 0 1 0 1 6 0 0 1 0 4 0 0 2 0 0 3 0 1 1 0 0 3 3 0 0 3 4 0 0 0 0 0 0 0 0 1 2 2 0 0 1 0 0 0 1 2 0 0 7 0 0 ...

output:

658
658
658
658
658
657
656
656
656
655
655
654
654
654
654
654
654
654
654
654
654
654
654
654
654
654
653
652
652
652
651
651
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
649
649
649
649
648
648
648
648
648
648
648
648
647
646
646
645
645
645
645
645
645
645
645
645
645
...

result:

ok 2000 numbers

Test #12:

score: 5
Accepted
time: 2ms
memory: 5732kb

input:

2000 2000
1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 0 ...

output:

152
0
185
0
404
1
402
1
366
2
27
2
179
3
459
3
423
3
389
3
285
3
324
4
167
4
99
5
379
5
395
5
412
5
360
5
222
6
341
7
31
7
10
8
101
8
202
9
262
9
211
9
118
9
274
9
71
10
102
11
61
11
329
12
106
12
236
13
226
13
441
14
87
15
416
15
502
15
188
16
409
16
276
16
413
17
324
17
213
18
437
18
164
18
364
18...

result:

ok 2000 numbers

Test #13:

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

input:

2000 2000
1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 ...

output:

331
1
422
1
340
1
452
1
303
1
456
0
432
1
1
1
278
2
186
2
404
2
400
2
365
2
462
2
330
3
435
3
74
4
409
3
261
4
413
3
405
3
244
2
316
2
126
2
73
3
5
3
59
4
204
3
190
4
54
3
135
4
258
4
92
4
115
3
90
4
131
4
375
4
6
4
276
4
61
4
278
5
269
5
232
6
319
5
270
5
455
5
368
5
31
5
381
6
224
5
58
5
222
5
395...

result:

ok 2000 numbers

Test #14:

score: 5
Accepted
time: 1ms
memory: 5620kb

input:

1000 2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

355
1
485
0
199
0
49
0
146
0
226
0
99
0
373
0
200
0
318
0
226
0
69
0
65
0
163
0
249
0
365
0
427
0
400
0
116
0
50
0
71
0
326
0
319
0
132
0
480
0
177
0
381
0
145
0
209
0
161
0
276
0
463
0
113
0
292
0
255
0
320
0
192
0
385
0
343
0
454
0
295
0
469
0
181
0
403
0
209
0
335
0
103
0
135
0
143
0
27
0
407
0
3...

result:

ok 2000 numbers

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #15:

score: 5
Accepted
time: 1ms
memory: 3728kb

input:

1 31
90776133
1 5009167
1 4129242
1 400355
1 -7556806
1 -4958489
1 -281120
1 -5292169
1 1337751
1 -38693
1 706169
1 470842
1 -8936304
1 7512180
1 733496
1 -9987641
1 1994575
1 8431617
1 2232187
1 2299272
1 1321472
1 2043728
1 -2916688
1 2050656
1 7149635
1 515185
1 -4759482
1 3482860
1 9529438
1 363...

output:

31928433
33304847
33438299
30919363
29266534
29172827
27408771
27854688
27841790
28077180
28234127
25255359
27759419
28003918
24674704
25339562
28150101
28894164
29660588
30101078
30782321
29810092
30493644
32876855
33048584
31462090
32623043
35799522
37012262
38169488
36655505

result:

ok 31 numbers

Test #16:

score: 0
Wrong Answer
time: 1ms
memory: 3692kb

input:

19 1
659060262 95878602 966370867 69420814 493217564 31019702 461451241 835666046 588474103 531368017 62183603 510896424 685443424 404947330 132329458 479633598 891034001 535806232 372317811
17 9490412

output:

4370325602

result:

wrong answer 1st numbers differ - expected: '2938669837', found: '4370325602'

Subtask #3:

score: 5
Accepted

Test #28:

score: 5
Accepted
time: 1ms
memory: 3752kb

input:

1999 2000
1 1 1 1 0 2 0 2 1 0 2 1 2 2 2 1 2 0 0 1 2 2 0 1 0 1 0 2 0 0 2 1 1 1 1 0 1 2 1 2 1 1 1 1 1 0 2 2 0 2 1 1 2 0 0 2 0 0 2 1 2 0 0 1 1 2 0 2 2 2 1 2 0 2 1 2 0 1 2 2 2 1 1 2 1 1 1 1 0 0 1 1 0 1 2 1 0 0 2 0 2 2 2 0 1 1 2 0 0 1 0 0 2 1 2 1 2 0 1 1 2 2 0 0 1 2 2 1 2 1 2 2 2 0 0 1 1 2 1 1 2 2 2 2 2 ...

output:

660
660
660
661
661
661
661
660
660
660
660
661
662
662
663
663
662
661
662
662
661
660
661
660
660
660
661
661
661
661
662
661
661
660
661
660
659
658
658
659
659
658
659
660
660
660
660
660
660
659
659
659
659
659
659
659
659
660
659
658
658
658
658
657
657
657
658
657
656
657
657
657
656
656
655
...

result:

ok 2000 numbers

Test #29:

score: 5
Accepted
time: 1ms
memory: 3740kb

input:

2000 2000
0 1 1 0 0 0 0 1 1 2 0 2 1 2 0 0 0 0 1 0 0 1 2 0 1 1 0 0 1 2 1 1 2 2 2 1 1 2 0 2 2 0 1 0 1 2 2 0 2 0 0 2 0 1 2 2 0 1 0 1 0 1 0 2 0 2 1 2 1 1 0 1 2 0 1 1 1 2 0 2 1 1 2 1 2 0 1 0 0 0 0 2 2 0 2 2 0 2 2 1 0 1 2 1 0 2 0 1 1 2 2 0 0 0 0 2 0 2 2 1 1 1 2 2 0 1 2 0 2 1 0 1 1 2 2 2 0 0 0 0 1 0 0 2 1 ...

output:

679
679
679
679
679
679
679
678
679
678
678
678
679
678
679
678
678
678
678
678
677
678
677
678
678
678
679
678
678
678
678
678
677
677
677
678
677
678
678
678
678
678
678
678
679
678
679
679
679
680
680
680
680
680
680
679
678
677
676
677
676
676
677
676
675
674
674
674
674
674
674
673
673
672
672
...

result:

ok 2000 numbers

Test #30:

score: 5
Accepted
time: 11ms
memory: 5796kb

input:

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

output:

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

result:

ok 200000 numbers

Test #31:

score: 5
Accepted
time: 124ms
memory: 15116kb

input:

200000 200000
2 0 1 2 2 0 2 0 1 1 1 2 0 1 1 0 1 2 2 1 1 0 0 1 0 1 0 1 0 2 1 1 2 0 2 2 2 2 2 0 0 1 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 2 1 2 1 0 1 1 2 0 2 2 0 0 0 1 2 1 2 0 0 0 0 2 2 2 0 2 1 1 1 0 0 0 2 1 1 0 1 0 1 1 2 2 1 1 1 0 2 2 2 2 0 2 1 1 0 0 1 2 0 2 0 2 1 0 2 0 0 1 1 0 1 0 2 0 1 2 0 2 0 1 2 0 2 1 ...

output:

66738
66738
66738
66738
66738
66739
66739
66739
66740
66739
66739
66739
66738
66739
66740
66739
66738
66739
66738
66738
66738
66739
66739
66739
66738
66739
66739
66738
66738
66737
66736
66736
66736
66737
66736
66735
66736
66735
66735
66736
66736
66736
66736
66735
66734
66733
66733
66733
66732
66732
...

result:

ok 200000 numbers

Test #32:

score: 5
Accepted
time: 127ms
memory: 16464kb

input:

200000 200000
2 1 1 1 1 2 0 0 1 2 1 0 0 2 2 1 0 0 1 1 0 1 2 0 1 0 2 0 1 2 2 2 2 0 0 1 2 2 1 2 1 2 1 2 0 0 0 0 2 0 2 2 0 2 2 1 2 2 1 1 2 0 0 0 0 1 0 0 2 1 1 2 2 1 1 0 1 0 0 2 2 0 0 2 1 2 1 1 2 1 0 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 0 1 0 2 0 2 2 2 2 1 0 1 1 0 0 0 2 2 2 2 2 0 1 0 0 2 1 0 2 2 2 2 2 2 2 ...

output:

66650
66650
66650
66650
66650
66650
66650
66650
66651
66650
66649
66649
66649
66648
66648
66648
66648
66648
66648
66648
66647
66646
66647
66647
66648
66648
66648
66648
66649
66649
66649
66649
66649
66649
66648
66648
66648
66649
66649
66648
66648
66648
66648
66648
66648
66647
66647
66647
66648
66647
...

result:

ok 200000 numbers

Test #33:

score: 5
Accepted
time: 133ms
memory: 15552kb

input:

200000 200000
0 1 2 1 1 1 1 0 2 2 2 1 0 2 2 1 0 1 0 1 1 2 0 0 0 2 0 0 2 0 2 0 0 1 0 2 0 1 0 2 1 0 2 2 1 0 0 1 2 0 1 0 1 2 0 0 2 0 2 1 2 2 2 1 1 2 1 0 2 1 0 0 1 2 1 1 0 1 0 0 2 0 0 0 2 1 0 1 0 2 0 1 1 0 2 0 0 0 1 2 2 0 2 0 0 0 2 1 1 1 2 1 2 2 2 1 0 1 1 2 0 2 2 2 1 1 0 0 1 1 2 0 2 1 1 0 2 2 1 0 2 2 1 ...

output:

66621
66621
66621
66621
66621
66621
66621
66621
66622
66622
66622
66622
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66622
66622
66623
66623
66622
66622
66623
66623
66623
66622
66622
66622
66622
66622
66622
66622
66622
...

result:

ok 200000 numbers

Test #34:

score: 5
Accepted
time: 128ms
memory: 15844kb

input:

200000 200000
2 0 0 2 2 0 2 0 2 0 0 0 2 2 0 0 1 0 0 2 1 2 1 2 0 0 2 0 2 0 0 0 0 1 2 0 2 0 1 2 0 2 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 2 2 0 1 1 0 0 0 1 1 2 0 2 0 1 0 2 2 0 0 2 1 2 0 2 0 1 0 2 2 0 0 2 1 0 0 2 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 2 0 2 1 0 0 0 0 0 2 1 1 0 1 0 0 2 2 0 2 0 0 2 0 1 0 0 2 0 0 1 1 ...

output:

49939
49939
49939
49938
49938
49939
49939
49939
49939
49939
49939
49939
49940
49940
49940
49940
49940
49940
49941
49940
49940
49940
49941
49940
49941
49941
49941
49941
49941
49941
49942
49941
49942
49942
49942
49942
49943
49943
49943
49943
49943
49943
49943
49943
49943
49944
49945
49945
49945
49945
...

result:

ok 200000 numbers

Subtask #4:

score: 0
Wrong Answer

Test #35:

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

input:

2000 1999
0 1 0 3 0 1 0 0 0 0 0 0 0 2 0 0 0 0 3 1 1 0 2 0 0 3 0 0 0 0 0 4 0 0 1 0 1 0 0 0 0 1 2 1 0 0 0 0 7 0 1 3 1 0 1 1 0 3 2 1 0 1 1 3 3 1 0 2 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 2 3 0 1 0 3 3 0 0 0 0 1 0 1 2 0 0 2 2 0 1 2 1 2 0 0 0 1 1 0 1 2 0 0 0 0 2 0 5 0 0 0 0 0 1 0 0 2 0 1 2 0 1 0 0 0 2 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
666
666
666
666
666
666
666
666
666
666
666
666
666
665
...

result:

ok 1999 numbers

Test #36:

score: 0
Wrong Answer
time: 2ms
memory: 5788kb

input:

1999 2000
938865181 635701131 720186551 12098533 888342577 819466162 677119886 695501777 87063160 544120940 280740814 953384275 462378756 394423771 769842478 563100233 988726627 938258387 941725041 202877851 608668845 507891555 488072389 600920090 738211573 440041095 584208199 334345340 587249363 60...

output:

501814469347
501814469348
501814469348
501814469348
501814469349
501814469348
501814469349
501814469349
501814469349
501814469348
501814469348
501814469348
501814469349
501814469348
501814469348
501814469348
501814469348
501814469348
501814469348
501814469348
501814469348
501814469348
501814469348
5...

result:

wrong answer 1st numbers differ - expected: '334310744804', found: '501814469347'

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%