QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#488343#9155. 集合g1ove100 ✓204ms23484kbC++141.1kb2024-07-23 21:32:292024-07-23 21:32:29

Judging History

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

  • [2024-07-23 21:32:29]
  • 评测
  • 测评结果:100
  • 用时:204ms
  • 内存:23484kb
  • [2024-07-23 21:32:29]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define N 1000005
using namespace std;
const int inf=1e9;
int n,m,q;
ull h[N];
ull shift(ull x)
{
	x+=114514;
	x^=(x<<7);
	x*=1919810;
	x^=(x>>11);
	x^=(x<<13);
	x^=(x>>8);
	return x;
}
int a[N][3],b[N][3];
int res[N];
ull suma[N],sumb[N];
ull ra,rb;
void modify(int x,ull w)
{
	for(int i=1;i<=3;i++)
	{
		ra-=shift(suma[a[x][i]]);
		rb-=shift(sumb[b[x][i]]);
		suma[a[x][i]]+=shift(x)*w,
		sumb[b[x][i]]+=shift(x)*w;
		ra+=shift(suma[a[x][i]]);
		rb+=shift(sumb[b[x][i]]);
	}
}
int main()
{
//	freopen("ex_3.in","r",stdin);
//	freopen("m.txt","w",stdout);
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=3;j++) scanf("%d",&a[i][j]); 
	for(int i=1;i<=n;i++)
		for(int j=1;j<=3;j++) scanf("%d",&b[i][j]); 
	int l=1,r=0;
	for(l=1;l<=n;l++)
	{
		while(r<=n)
		{
			if(ra^rb) break;
			modify(++r,1);
		}
		modify(l,-1);
		res[l]=r-1;
	}
	while(q--)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		printf(res[u]>=v?"Yes\n":"No\n");
	}
	return 0;
}

Details


Pretests

Pretest #1:

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

Pretest #2:

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

Pretest #3:

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

Pretest #4:

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

Pretest #5:

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

Pretest #6:

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

Pretest #7:

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

Pretest #8:

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

Pretest #9:

score: 5
Accepted
time: 18ms
memory: 9956kb

Pretest #10:

score: 5
Accepted
time: 22ms
memory: 9992kb

Pretest #11:

score: 5
Accepted
time: 78ms
memory: 14096kb

Pretest #12:

score: 5
Accepted
time: 81ms
memory: 16092kb

Pretest #13:

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

Pretest #14:

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

Pretest #15:

score: 5
Accepted
time: 116ms
memory: 10016kb

Pretest #16:

score: 5
Accepted
time: 115ms
memory: 10104kb

Pretest #17:

score: 5
Accepted
time: 7ms
memory: 9996kb

Pretest #18:

score: 5
Accepted
time: 9ms
memory: 10936kb

Pretest #19:

score: 5
Accepted
time: 193ms
memory: 14140kb

Pretest #20:

score: 5
Accepted
time: 195ms
memory: 23460kb

Final Tests

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

score: 5
Accepted
time: 23ms
memory: 10052kb

Test #10:

score: 5
Accepted
time: 18ms
memory: 10000kb

Test #11:

score: 5
Accepted
time: 82ms
memory: 14108kb

Test #12:

score: 5
Accepted
time: 78ms
memory: 16200kb

Test #13:

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

Test #14:

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

Test #15:

score: 5
Accepted
time: 115ms
memory: 10016kb

Test #16:

score: 5
Accepted
time: 112ms
memory: 10144kb

Test #17:

score: 5
Accepted
time: 4ms
memory: 10004kb

Test #18:

score: 5
Accepted
time: 9ms
memory: 10944kb

Test #19:

score: 5
Accepted
time: 179ms
memory: 16192kb

Test #20:

score: 5
Accepted
time: 204ms
memory: 23484kb

Extra Test:

score: 0
Extra Test Passed