QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825249#9774. Same Sumucup-team5318#WA 1642ms47208kbC++145.6kb2024-12-21 17:52:412024-12-21 17:52:41

Judging History

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

  • [2025-01-11 11:59:18]
  • hack成功,自动添加数据
  • (/hack/1443)
  • [2024-12-23 17:02:06]
  • hack成功,自动添加数据
  • (/hack/1310)
  • [2024-12-23 16:48:26]
  • hack成功,自动添加数据
  • (/hack/1309)
  • [2024-12-23 16:33:45]
  • hack成功,自动添加数据
  • (/hack/1308)
  • [2024-12-23 16:23:53]
  • hack成功,自动添加数据
  • (/hack/1307)
  • [2024-12-23 16:13:08]
  • hack成功,自动添加数据
  • (/hack/1306)
  • [2024-12-23 15:54:42]
  • hack成功,自动添加数据
  • (/hack/1305)
  • [2024-12-23 14:58:39]
  • hack成功,自动添加数据
  • (/hack/1304)
  • [2024-12-23 09:58:11]
  • hack成功,自动添加数据
  • (/hack/1302)
  • [2024-12-23 09:47:22]
  • hack成功,自动添加数据
  • (/hack/1301)
  • [2024-12-23 09:41:23]
  • hack成功,自动添加数据
  • (/hack/1300)
  • [2024-12-23 09:26:32]
  • hack成功,自动添加数据
  • (/hack/1299)
  • [2024-12-23 09:19:58]
  • hack成功,自动添加数据
  • (/hack/1298)
  • [2024-12-23 09:13:29]
  • hack成功,自动添加数据
  • (/hack/1297)
  • [2024-12-22 18:52:18]
  • hack成功,自动添加数据
  • (/hack/1296)
  • [2024-12-22 18:13:14]
  • hack成功,自动添加数据
  • (/hack/1294)
  • [2024-12-21 17:52:41]
  • 评测
  • 测评结果:WA
  • 用时:1642ms
  • 内存:47208kb
  • [2024-12-21 17:52:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rd(time(0));
const int N=2e5+5,mod=1e9+9;
const ll inf=4e18;
int n,q,a[N],vv[N],v1[N],c[15][15];
namespace work1
{
	struct Seg_tree
	{
		struct STree{int l,r,v[8],add;ll minn,maxn,add1;}t[N*4];
		void pushup(int p){for(int i=0;i<=7;i++)t[p].v[i]=(t[p*2].v[i]+t[p*2+1].v[i])%mod,t[p].minn=min(t[p*2].minn,t[p*2+1].minn),t[p].maxn=max(t[p*2].maxn,t[p*2+1].maxn);}
		void update(int p,int vv)
		{
			t[p].add=(t[p].add+vv)%mod;
			for(int i=7;i>=0;i--)
			{
				int nv=vv;
				for(int j=i-1;j>=0;j--)t[p].v[i]=(t[p].v[i]+1ll*t[p].v[j]*c[i][j]%mod*nv)%mod,nv=1ll*nv*vv%mod;
			}
		}
		void update1(int p,ll vv)
		{
			t[p].add1+=vv,t[p].minn+=vv,t[p].maxn+=vv;
		}
		void pushdown(int p)
		{
			if(t[p].add)update(p*2,t[p].add),update(p*2+1,t[p].add),t[p].add=0;
			if(t[p].add1)update1(p*2,t[p].add1),update1(p*2+1,t[p].add1),t[p].add1=0;
		}
		void build(int p,int l,int r)
		{
			t[p].l=l,t[p].r=r;
			if(l==r)
			{
				t[p].v[0]=1,t[p].minn=t[p].maxn=a[l];
				for(int i=1;i<=7;i++)t[p].v[i]=1ll*t[p].v[i-1]*a[l]%mod;
				return ;
			}
			int mid=l+r>>1;
			build(p*2,l,mid),build(p*2+1,mid+1,r),pushup(p);
		}
		void change(int p,int l,int r,int v)
		{
			if(l<=t[p].l && t[p].r<=r)return update(p,v),update1(p,v);pushdown(p);
			int mid=t[p].l+t[p].r>>1;
			if(l<=mid)change(p*2,l,r,v);if(mid<r)change(p*2+1,l,r,v);pushup(p);
		}
		void ask(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r){for(int i=0;i<=7;i++)v1[i]=(v1[i]+t[p].v[i])%mod;return ;}pushdown(p);
			int mid=t[p].l+t[p].r>>1;
			if(l<=mid)ask(p*2,l,r);if(mid<r)ask(p*2+1,l,r);
		}
		ll ask1(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r)return t[p].minn;pushdown(p);
			int mid=t[p].l+t[p].r>>1;ll res=inf;
			if(l<=mid)res=min(res,ask1(p*2,l,r));if(mid<r)res=min(res,ask1(p*2+1,l,r));return res;
		}
		ll ask2(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r)return t[p].maxn;pushdown(p);
			int mid=t[p].l+t[p].r>>1;ll res=-inf;
			if(l<=mid)res=max(res,ask2(p*2,l,r));if(mid<r)res=max(res,ask2(p*2+1,l,r));return res;
		}
	}t1;
	void solve()
	{
		for(int i=1;i<=n;i++)scanf("%d",&a[i]),a[i]*=2;
		t1.build(1,1,n);
		while(q--)
		{
			int op,l,r,v;
			scanf("%d %d %d",&op,&l,&r);
			if(op==1)
			{
				scanf("%d",&v),v*=2;
				t1.change(1,l,r,v);
			}
			else
			{
				for(int i=0;i<=7;i++)v1[i]=0;
				t1.ask(1,l,r);
				ll minn=t1.ask1(1,l,r),maxn=t1.ask2(1,l,r);
				ll mid=minn+maxn>>1;
				mid%=mod;
				bool fl=0;
				for(int i=1;i<=7;i+=2)
				{
					int now=0,num=1;
					for(int j=0;j<=i;j++)
					{
						now=(now+1ll*num*v1[i-j]%mod*c[i][j])%mod;
						num=1ll*num*(mod-mid)%mod;
					}
					if(now!=0){fl=1;break;}
				}
				if(fl)printf("NO\n");else printf("YES\n");
			}
		}
	}
}
namespace work2
{
	struct Seg_tree
	{
		struct STree{int l,r,v[12],add;ll minn,maxn,add1;}t[N*4];
		void pushup(int p){for(int i=0;i<=11;i++)t[p].v[i]=(t[p*2].v[i]+t[p*2+1].v[i])%mod,t[p].minn=min(t[p*2].minn,t[p*2+1].minn),t[p].maxn=max(t[p*2].maxn,t[p*2+1].maxn);}
		void update(int p,int vv)
		{
			t[p].add=(t[p].add+vv)%mod;
			for(int i=11;i>=0;i--)
			{
				int nv=vv;
				for(int j=i-1;j>=0;j--)t[p].v[i]=(t[p].v[i]+1ll*t[p].v[j]*c[i][j]%mod*nv)%mod,nv=1ll*nv*vv%mod;
			}
		}
		void update1(int p,ll vv)
		{
			t[p].add1+=vv,t[p].minn+=vv,t[p].maxn+=vv;
		}
		void pushdown(int p)
		{
			if(t[p].add)update(p*2,t[p].add),update(p*2+1,t[p].add),t[p].add=0;
			if(t[p].add1)update1(p*2,t[p].add1),update1(p*2+1,t[p].add1),t[p].add1=0;
		}
		void build(int p,int l,int r)
		{
			t[p].l=l,t[p].r=r;
			if(l==r)
			{
				t[p].v[0]=1,t[p].minn=t[p].maxn=a[l];
				for(int i=1;i<=11;i++)t[p].v[i]=1ll*t[p].v[i-1]*a[l]%mod;
				return ;
			}
			int mid=l+r>>1;
			build(p*2,l,mid),build(p*2+1,mid+1,r),pushup(p);
		}
		void change(int p,int l,int r,int v)
		{
			if(l<=t[p].l && t[p].r<=r)return update(p,v),update1(p,v);pushdown(p);
			int mid=t[p].l+t[p].r>>1;
			if(l<=mid)change(p*2,l,r,v);if(mid<r)change(p*2+1,l,r,v);pushup(p);
		}
		void ask(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r){for(int i=0;i<=11;i++)v1[i]=(v1[i]+t[p].v[i])%mod;return ;}pushdown(p);
			int mid=t[p].l+t[p].r>>1;
			if(l<=mid)ask(p*2,l,r);if(mid<r)ask(p*2+1,l,r);
		}
		ll ask1(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r)return t[p].minn;pushdown(p);
			int mid=t[p].l+t[p].r>>1;ll res=inf;
			if(l<=mid)res=min(res,ask1(p*2,l,r));if(mid<r)res=min(res,ask1(p*2+1,l,r));return res;
		}
		ll ask2(int p,int l,int r)
		{
			if(l<=t[p].l && t[p].r<=r)return t[p].maxn;pushdown(p);
			int mid=t[p].l+t[p].r>>1;ll res=-inf;
			if(l<=mid)res=max(res,ask2(p*2,l,r));if(mid<r)res=max(res,ask2(p*2+1,l,r));return res;
		}
	}t1;
	void solve()
	{
		for(int i=1;i<=n;i++)scanf("%d",&a[i]),a[i]*=2;
		t1.build(1,1,n);
		while(q--)
		{
			int op,l,r,v;
			scanf("%d %d %d",&op,&l,&r);
			if(op==1)
			{
				scanf("%d",&v),v*=2;
				t1.change(1,l,r,v);
			}
			else
			{
				for(int i=0;i<=11;i++)v1[i]=0;
				t1.ask(1,l,r);
				ll minn=t1.ask1(1,l,r),maxn=t1.ask2(1,l,r);
				ll mid=minn+maxn>>1;
				mid%=mod;
				bool fl=0;
				for(int i=1;i<=11;i+=2)
				{
					int now=0,num=1;
					for(int j=0;j<=i;j++)
					{
						now=(now+1ll*num*v1[i-j]%mod*c[i][j])%mod;
						num=1ll*num*(mod-mid)%mod;
					}
					if(now!=0){fl=1;break;}
				}
				if(fl)printf("NO\n");else printf("YES\n");
			}
		}
	}
}
int main()
{
	for(int i=0;i<=14;i++){c[i][0]=1;for(int j=1;j<=i;j++)c[i][j]=c[i-1][j]+c[i-1][j-1];}
	scanf("%d %d",&n,&q);
	if(n<=1e5 || q<=1e5)work2::solve();
	else work1::solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5984kb

input:

8 4
1 2 3 4 5 6 7 8
2 1 8
1 1 4 4
2 1 6
2 1 8

output:

YES
NO
YES

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

score: 0
Accepted
time: 1592ms
memory: 45608kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 100047 token(s): yes count is 22, no count is 100025

Test #3:

score: 0
Accepted
time: 1531ms
memory: 45736kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 99734 token(s): yes count is 10, no count is 99724

Test #4:

score: 0
Accepted
time: 1573ms
memory: 45560kb

input:

200000 200000
185447 70128 80288 38126 188018 126450 46081 189881 15377 21028 12588 100061 7218 74518 162803 34448 90998 44793 167718 16370 136024 153269 186316 137564 3082 169700 175712 19214 82647 72919 170919 142138 57755 168197 81575 126456 183138 106882 167154 184388 198667 190302 188371 183732...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 99837 token(s): yes count is 11, no count is 99826

Test #5:

score: 0
Accepted
time: 1580ms
memory: 45252kb

input:

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

output:

NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
...

result:

ok 99868 token(s): yes count is 34, no count is 99834

Test #6:

score: 0
Accepted
time: 1592ms
memory: 45740kb

input:

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

output:

NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO...

result:

ok 99999 token(s): yes count is 32, no count is 99967

Test #7:

score: 0
Accepted
time: 1603ms
memory: 45596kb

input:

200000 200000
185447 14553 70128 129872 80288 119712 38126 161874 188018 11982 126450 73550 46081 153919 189881 10119 15377 184623 21028 178972 12588 187412 100061 99939 7218 192782 74518 125482 162803 37197 34448 165552 90998 109002 44793 155207 167718 32282 16370 183630 136024 63976 153269 46731 1...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 99951 token(s): yes count is 16, no count is 99935

Test #8:

score: 0
Accepted
time: 1586ms
memory: 45648kb

input:

200000 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 99715 token(s): yes count is 40, no count is 99675

Test #9:

score: 0
Accepted
time: 1606ms
memory: 45496kb

input:

200000 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 100013 token(s): yes count is 34, no count is 99979

Test #10:

score: 0
Accepted
time: 1642ms
memory: 47208kb

input:

200000 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 99963 token(s): yes count is 34, no count is 99929

Test #11:

score: 0
Accepted
time: 43ms
memory: 5924kb

input:

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

output:

YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 46656 token(s): yes count is 4986, no count is 41670

Test #12:

score: 0
Accepted
time: 383ms
memory: 45608kb

input:

200000 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
Y...

result:

ok 200000 token(s): yes count is 142548, no count is 57452

Test #13:

score: 0
Accepted
time: 348ms
memory: 45740kb

input:

200000 200000
192638 7362 141854 58146 18695 181305 143615 56385 20728 179272 179861 20139 78463 121537 79967 120033 121724 78276 131821 68179 140320 59680 124938 75062 119503 80497 14769 185231 50662 149338 82361 117639 43840 156160 110453 89547 64825 135175 177198 22802 147890 52110 197055 2945 12...

output:

NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
YES...

result:

ok 200000 token(s): yes count is 48250, no count is 151750

Test #14:

score: 0
Accepted
time: 75ms
memory: 45200kb

input:

200000 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 99626 token(s): yes count is 99626, no count is 0

Test #15:

score: -100
Wrong Answer
time: 369ms
memory: 45324kb

input:

197608 196219
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

YES

result:

wrong answer expected NO, found YES [1st token]