QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#822408#9907. 最大匹配 2 LiWenX25 3ms4956kbC++202.1kb2024-12-20 11:45:102024-12-20 11:45:14

Judging History

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

  • [2024-12-20 11:45:14]
  • 评测
  • 测评结果:25
  • 用时:3ms
  • 内存:4956kb
  • [2024-12-20 11:45:10]
  • 提交

answer

//Mashiro
#include<bits/stdc++.h>

#define vc vector
#define db double
#define fi first
#define se second
#define ll long long
#define mk make_pair
#define pb push_back
#define RI register int
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << "   -_-   " << endl
#define debug cerr << " ------------------- " << endl

#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)

#define NO puts("No")
#define YES puts("Yes")

//#define OccDreamer
//#define int long long

using namespace std;

namespace IO{
	inline ll read(){
		ll X=0, W=0; char ch=getchar();
		while(!isdigit(ch)) W|=ch=='-', ch=getchar();
		while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
		return W?-X:X;
	}
	inline void write(ll x){
		if(x<0) x=-x, putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
	inline void sprint(ll x){write(x), putchar(31);}
	inline void eprint(ll x){write(x), putchar(10);}
}using namespace IO;

const int MAXN = 1e5 + 6;
const int mod = 1e9 + 7;

int n, m, a[MAXN];
int now[MAXN], b[MAXN];

bool mark[MAXN]; 

inline int solve(){
	memset(now,0,sizeof now);
	memset(mark,0,sizeof mark);
	int ans=0;
	for(int i=1;i<=n;++i){
		if(a[i]==0) now[b[i]]++;
		else{
			if(now[b[i]]>0){
				now[b[i]]--;
				mark[i]=1; ++ans;
			}
		}
	}
	memset(now,0,sizeof now);
	for(int i=n;i>=1;--i){
		if(a[i]==1) now[b[i]]++;
		else{
			if(now[b[i]]>0){
				now[b[i]]--;
				mark[i]=1;
			}
		}
	}
	int cur=0;
	for(int i=1;i<=n;++i){
		if(mark[i]) continue;
		if(a[i]==0){
			cur++; 
		}
		else{
			if(cur) cur--, ans++;
		}
	}
	return ans;
}

int main(){
//  freopen("bracket.in","r",stdin);
//  freopen("bracket.out","w",stdout);
	n=read(), m=read(); int all=0;
  for(int i=1;i<=n;++i) b[i]=read();
  for(int i=1;i<=n;++i) a[i]=read();
	eprint(solve());
	while(m--){
		int x, p, q;
		x=read(), q=read(), p=read();
		a[x]=p; b[x]=q; eprint(solve()); 
	}
	return 0;
}
/*
10 10
2 1 2 2 2 2 1 2 2 2
1 1 0 0 0 0 1 0 0 0
3 2 0
5 1 0
9 1 1
4 2 1
8 1 1
2 1 0
1 2 1
8 2 0
1 1 1
9 1 0
*/ 

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 4092kb

input:

100 0
1 1 2 1 2 2 2 2 2 1 2 1 1 2 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 1 2 1 2 1 1 1 2 2 2 2 2 2 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 1 2 1 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 2 1 1 2
1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 ...

output:

45

result:

ok "45"

Test #2:

score: 10
Accepted
time: 1ms
memory: 4092kb

input:

100 0
2 1 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 2 2 1 2 1 2 2 1 1 2 2 1 1 1 2 1 1 1 2 2 1 2 1 1 2 2 2 2 2 1 2 1 2 2 1 1 2 1 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 1 2 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 1 1 2 2 1 2 1 2 2 2 2 1 2
0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 1 1 0 ...

output:

43

result:

ok "43"

Test #3:

score: 10
Accepted
time: 1ms
memory: 4152kb

input:

100 0
2 2 3 3 4 4 3 2 4 4 1 2 3 4 3 4 4 3 3 2 3 1 2 4 1 3 1 4 3 3 4 4 3 3 1 4 1 1 2 2 1 3 4 3 3 4 3 3 4 3 4 3 4 4 1 1 1 4 3 1 2 1 2 3 3 3 2 1 1 1 1 3 3 2 4 2 3 4 1 4 1 4 1 1 2 1 1 1 1 1 4 4 2 3 2 1 2 3 1 4
1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 0 1 ...

output:

37

result:

ok "37"

Test #4:

score: 10
Accepted
time: 1ms
memory: 4172kb

input:

100 0
3 1 2 4 3 2 2 1 4 2 2 3 2 1 1 2 3 3 2 3 1 1 3 4 3 2 1 2 4 3 4 2 2 1 2 4 2 2 1 1 3 3 1 2 3 4 3 2 3 2 2 1 3 3 1 2 3 2 2 3 3 4 2 2 1 4 1 3 2 3 3 4 4 3 2 1 4 2 2 3 4 2 3 2 3 4 3 3 1 2 3 4 3 1 4 1 2 2 2 3
1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 ...

output:

44

result:

ok "44"

Test #5:

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

input:

100 0
3 6 4 7 5 4 7 5 1 1 6 8 5 5 6 7 3 6 3 3 7 5 6 4 8 4 6 4 8 3 8 6 6 6 3 6 2 7 7 1 2 7 3 8 4 8 2 8 4 5 4 2 2 1 6 1 1 8 2 1 4 4 1 1 5 6 2 3 2 6 1 5 2 6 7 8 6 5 7 1 7 1 8 1 8 6 3 6 3 7 1 3 3 8 8 4 5 7 1 5
0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 ...

output:

37

result:

ok "37"

Test #6:

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

input:

100 0
3 5 6 3 4 8 4 1 3 7 6 7 2 8 2 2 2 4 1 1 1 8 8 7 6 2 6 7 1 3 1 3 2 2 5 2 2 7 2 8 5 3 5 4 1 6 8 8 4 5 3 6 3 6 2 7 1 6 1 3 3 2 6 8 4 2 6 6 4 5 5 4 4 8 3 3 2 7 1 7 4 6 3 3 8 8 1 7 4 1 8 8 7 1 4 7 7 7 3 2
0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 ...

output:

39

result:

ok "39"

Test #7:

score: 10
Accepted
time: 1ms
memory: 4172kb

input:

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

output:

37

result:

ok "37"

Test #8:

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

input:

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

output:

35

result:

ok "35"

Test #9:

score: 10
Accepted
time: 1ms
memory: 4092kb

input:

100 0
3 21 1 30 24 27 22 30 2 12 14 13 24 4 6 14 29 1 8 29 16 21 27 18 9 20 2 1 17 7 13 19 12 16 17 27 1 2 27 1 2 5 13 21 24 14 26 19 29 18 19 4 28 31 23 25 8 21 2 24 19 17 2 7 14 13 8 16 24 29 13 1 30 28 9 25 24 10 22 6 19 20 26 32 1 1 5 19 22 31 19 21 10 25 16 17 20 1 7 22
0 1 0 1 1 1 0 1 0 1 0 1 ...

output:

38

result:

ok "38"

Test #10:

score: 10
Accepted
time: 1ms
memory: 4100kb

input:

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

output:

44

result:

ok "44"

Subtask #2:

score: 15
Accepted

Test #11:

score: 15
Accepted
time: 0ms
memory: 4040kb

input:

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

output:

954

result:

ok "954"

Test #12:

score: 15
Accepted
time: 1ms
memory: 4184kb

input:

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

output:

958

result:

ok "958"

Test #13:

score: 15
Accepted
time: 1ms
memory: 4104kb

input:

2000 0
4 3 4 4 2 2 2 2 3 1 1 3 1 3 3 3 1 4 2 2 2 4 4 3 3 3 1 1 3 1 2 1 2 1 1 4 1 2 2 4 3 3 1 3 2 2 1 3 2 1 3 4 3 2 3 4 3 1 3 2 2 1 4 2 4 4 3 4 1 3 3 1 3 1 3 1 4 3 4 4 4 3 4 1 3 2 4 3 4 3 1 3 2 4 1 4 2 1 2 2 4 4 1 4 2 4 1 1 1 2 1 1 4 1 1 2 2 1 4 2 2 3 4 2 2 3 1 4 1 1 2 2 1 3 2 1 3 2 3 3 1 1 2 4 1 1 4...

output:

946

result:

ok "946"

Test #14:

score: 15
Accepted
time: 1ms
memory: 4192kb

input:

2000 0
1 2 4 3 3 3 2 3 1 4 4 1 4 4 1 2 3 4 2 3 1 2 1 4 3 4 3 3 4 3 4 4 1 4 4 2 4 4 2 1 2 3 2 3 2 4 2 2 3 4 3 3 4 3 4 4 4 4 2 2 4 3 4 3 1 3 3 2 2 2 4 3 1 1 2 1 2 2 2 1 1 2 1 4 2 3 4 1 4 1 1 4 1 2 1 1 4 4 3 2 4 1 2 1 1 1 1 2 4 2 2 3 4 1 1 4 2 2 4 3 3 1 2 3 2 1 4 2 2 1 4 2 2 4 3 3 1 2 2 3 4 3 1 4 3 1 1...

output:

945

result:

ok "945"

Test #15:

score: 15
Accepted
time: 0ms
memory: 4128kb

input:

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

output:

947

result:

ok "947"

Test #16:

score: 15
Accepted
time: 0ms
memory: 4116kb

input:

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

output:

948

result:

ok "948"

Test #17:

score: 15
Accepted
time: 1ms
memory: 4060kb

input:

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

output:

949

result:

ok "949"

Test #18:

score: 15
Accepted
time: 1ms
memory: 4116kb

input:

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

output:

928

result:

ok "928"

Test #19:

score: 15
Accepted
time: 1ms
memory: 4132kb

input:

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

output:

950

result:

ok "950"

Test #20:

score: 15
Accepted
time: 1ms
memory: 4104kb

input:

2000 0
20 17 13 28 19 28 19 12 16 15 8 32 3 1 21 10 13 16 28 16 11 2 3 28 4 26 31 15 7 13 10 5 19 10 1 22 20 13 10 9 25 6 8 10 27 32 10 25 31 22 11 31 7 9 12 8 32 21 2 25 20 1 11 10 28 2 5 32 30 29 3 30 13 28 29 13 29 10 18 20 5 19 21 9 2 29 7 19 11 22 12 27 30 30 8 18 31 32 11 10 23 29 19 3 10 32 2...

output:

918

result:

ok "918"

Test #21:

score: 15
Accepted
time: 1ms
memory: 4112kb

input:

2000 0
29 39 61 16 16 45 3 35 24 19 61 12 42 36 49 32 58 54 27 17 11 47 59 3 47 37 41 13 30 39 37 46 60 48 9 63 12 3 8 3 49 9 26 64 36 42 56 47 33 54 40 47 19 17 48 56 44 38 32 61 15 51 7 11 57 19 15 22 42 2 23 19 48 28 47 55 34 49 9 21 56 38 63 29 5 25 30 62 49 62 21 58 59 3 19 4 61 4 48 45 33 6 14...

output:

909

result:

ok "909"

Test #22:

score: 15
Accepted
time: 1ms
memory: 4064kb

input:

2000 0
28 13 36 62 2 58 55 9 2 14 56 45 12 61 21 52 29 6 12 48 20 43 37 41 7 47 64 23 15 12 7 42 15 31 43 7 64 30 11 3 7 17 13 46 49 6 47 10 55 17 33 37 9 52 63 28 45 27 25 53 55 51 34 23 41 31 18 11 31 37 18 45 45 31 27 58 29 12 16 44 19 45 64 55 7 20 31 27 34 35 11 63 57 17 2 34 1 54 20 37 55 4 11...

output:

900

result:

ok "900"

Test #23:

score: 15
Accepted
time: 0ms
memory: 4060kb

input:

2000 0
31 104 15 67 66 31 37 55 12 115 95 50 47 3 115 11 25 8 40 43 117 107 99 3 9 75 111 115 74 97 24 8 16 86 71 59 43 25 63 121 125 19 109 83 105 62 20 65 17 57 47 51 69 18 114 18 97 96 114 5 68 74 125 5 33 85 75 73 110 75 95 104 104 28 127 89 22 30 88 9 69 43 110 32 104 1 116 52 127 121 35 15 85 ...

output:

872

result:

ok "872"

Test #24:

score: 15
Accepted
time: 0ms
memory: 4120kb

input:

2000 0
11 44 53 57 20 98 36 75 12 56 9 94 7 128 42 27 3 95 19 97 109 35 114 115 4 9 34 104 63 29 65 60 50 36 98 53 67 12 117 75 116 78 45 36 78 48 63 23 121 16 126 12 112 78 100 60 44 48 85 108 3 38 94 21 67 54 14 116 27 50 114 68 17 3 81 64 96 5 50 65 33 122 102 100 33 101 44 114 66 80 99 44 121 11...

output:

883

result:

ok "883"

Test #25:

score: 15
Accepted
time: 1ms
memory: 4188kb

input:

2000 0
212 40 232 87 79 203 233 171 143 9 124 97 47 54 250 185 169 100 244 253 120 131 85 195 8 234 73 7 171 247 118 184 64 132 82 42 64 116 53 137 155 33 87 164 160 6 168 102 125 31 63 39 229 76 16 65 100 244 26 83 73 232 85 146 135 196 233 175 96 240 214 248 208 164 128 8 29 60 103 140 214 151 114...

output:

852

result:

ok "852"

Test #26:

score: 15
Accepted
time: 1ms
memory: 4104kb

input:

2000 0
228 227 120 56 250 38 238 224 14 1 239 70 20 90 235 248 114 33 47 210 111 244 218 72 51 144 243 191 168 149 165 105 89 224 147 217 17 46 79 207 48 94 182 80 209 145 45 40 47 255 3 118 55 96 6 172 35 130 26 116 40 68 68 102 184 92 10 94 52 66 53 237 6 189 28 16 106 208 50 33 68 24 249 191 102 ...

output:

863

result:

ok "863"

Test #27:

score: 15
Accepted
time: 1ms
memory: 4108kb

input:

2000 0
510 427 155 433 37 348 174 418 481 8 170 485 274 110 187 213 285 60 125 460 135 101 299 75 83 33 268 169 125 472 46 363 60 155 232 365 4 213 384 468 6 404 133 201 483 251 129 319 129 505 71 261 251 76 460 122 65 387 507 149 432 372 200 243 499 394 440 239 284 93 298 154 35 416 156 474 494 116...

output:

866

result:

ok "866"

Test #28:

score: 15
Accepted
time: 1ms
memory: 4032kb

input:

2000 0
354 297 56 124 319 256 97 329 474 344 18 227 225 116 272 259 287 6 411 222 281 145 104 62 84 239 320 231 424 262 323 232 278 142 84 288 11 323 322 482 405 108 223 168 381 137 191 8 15 466 220 360 450 109 109 243 226 340 504 102 371 197 219 6 174 248 314 401 4 396 69 179 158 18 294 197 412 498...

output:

864

result:

ok "864"

Test #29:

score: 15
Accepted
time: 1ms
memory: 4064kb

input:

2000 0
393 713 332 785 736 132 371 355 885 858 647 475 461 236 796 95 786 256 736 260 862 1020 895 868 364 1018 75 856 217 269 567 759 553 133 647 397 651 167 171 651 1006 5 833 305 300 578 438 242 790 902 810 973 625 232 838 205 231 796 453 274 851 632 111 269 885 482 875 156 558 218 384 382 110 75...

output:

859

result:

ok "859"

Test #30:

score: 15
Accepted
time: 1ms
memory: 4040kb

input:

2000 0
836 681 896 743 896 179 455 358 975 7 681 109 434 847 226 878 352 835 665 569 694 543 35 103 719 764 921 671 739 70 972 467 1001 835 613 209 593 617 940 69 170 622 651 981 309 191 492 513 811 909 74 527 511 222 565 304 415 17 695 332 474 237 519 568 118 86 22 185 174 690 977 404 502 600 965 6...

output:

889

result:

ok "889"

Subtask #3:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 3ms
memory: 4956kb

input:

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

output:

0
0

result:

wrong answer 1st words differ - expected: '99478', found: '0'

Subtask #4:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 3ms
memory: 4952kb

input:

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

output:

0

result:

wrong answer 1st words differ - expected: '99575', found: '0'

Subtask #5:

score: 0
Time Limit Exceeded

Test #71:

score: 0
Time Limit Exceeded

input:

100000 100000
2 1 1 1 1 1 1 2 2 2 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 1 1 2 1 2 2 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 2 2 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 2 2 2 2 2 1 1 2 1 1 1 1 ...

output:

49860
49859
49859
49859
49858
49858
49858
49859
49858
49858
49857
49858
49858
49857
49856
49855
49854
49854
49854
49854
49854
49854
49854
49854
49853
49853
49854
49854
49855
49855
49854
49854
49853
49852
49852
49852
49852
49851
49851
49852
49852
49851
49850
49849
49849
49849
49849
49848
49848
49848
...

result:


Subtask #6:

score: 0
Wrong Answer

Test #101:

score: 0
Wrong Answer
time: 0ms
memory: 4860kb

input:

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

output:

0

result:

wrong answer 1st words differ - expected: '99491', found: '0'