QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488482#9155. 集合yjhyjh100 ✓89ms27324kbC++141.3kb2024-07-24 08:17:462024-07-24 08:17:47

Judging History

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

  • [2024-07-24 08:17:47]
  • 评测
  • 测评结果:100
  • 用时:89ms
  • 内存:27324kb
  • [2024-07-24 08:17:46]
  • 提交

answer

#include<bits/stdc++.h>
#define pow power
#define ull unsigned long long
using namespace std;
template<typename T>void read(T &x)
{
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+c-'0';
	x=x*f;
}
template<typename T>void write(T x)
{
	if(x<0)
	{
		putchar('-');
		write(-x);
		return ;
	}
	if(x>=10) write(x/10);
	putchar(x%10+'0');
}
const int N=1e7+5;
const ull p=13337;
ull get(ull x)
{
	return x*x*x;
}
ull pw[N];
int a[N][3],b[N][3];
int rp[N];
ull ta[N],tb[N];
ull suma,sumb;
void solve(int id,int fl)
{
	for(int i=0;i<3;i++)
	{
		suma-=get(ta[a[id][i]]);
		ta[a[id][i]]+=fl*pw[id];
		suma+=get(ta[a[id][i]]);
		sumb-=get(tb[b[id][i]]);
		tb[b[id][i]]+=fl*pw[id];
		sumb+=get(tb[b[id][i]]);
	}
}
int main()
{
	int n,m,q;
	read(n);read(m);read(q);
	for(int i=1;i<=n;i++)
		for(int j=0;j<3;j++)
			read(a[i][j]);
	for(int i=1;i<=n;i++)
		for(int j=0;j<3;j++)
			read(b[i][j]);
	pw[0]=1;
	for(int i=1;i<=n;i++) pw[i]=pw[i-1]*p;
	int r=0;
	for(int l=1;l<=n;l++)
	{
		while(suma==sumb&&r<=n)
		{
			solve(r+1,1);
			r++;
		}
		rp[l]=r-1;
		solve(l,-1);
	}
	while(q--)
	{
		int l,r;
		read(l);read(r);
		if(r<=rp[l]) puts("Yes");
		else puts("No");
	}
	return 0;
}

详细


Pretests

Pretest #1:

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

Pretest #2:

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

Pretest #3:

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

Pretest #4:

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

Pretest #5:

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

Pretest #6:

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

Pretest #7:

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

Pretest #8:

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

Pretest #9:

score: 5
Accepted
time: 5ms
memory: 11792kb

Pretest #10:

score: 5
Accepted
time: 5ms
memory: 11808kb

Pretest #11:

score: 5
Accepted
time: 25ms
memory: 19948kb

Pretest #12:

score: 5
Accepted
time: 25ms
memory: 17880kb

Pretest #13:

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

Pretest #14:

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

Pretest #15:

score: 5
Accepted
time: 49ms
memory: 11820kb

Pretest #16:

score: 5
Accepted
time: 51ms
memory: 11816kb

Pretest #17:

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

Pretest #18:

score: 5
Accepted
time: 5ms
memory: 14740kb

Pretest #19:

score: 5
Accepted
time: 86ms
memory: 18052kb

Pretest #20:

score: 5
Accepted
time: 89ms
memory: 27312kb

Final Tests

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

score: 5
Accepted
time: 10ms
memory: 11880kb

Test #10:

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

Test #11:

score: 5
Accepted
time: 29ms
memory: 22124kb

Test #12:

score: 5
Accepted
time: 24ms
memory: 20072kb

Test #13:

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

Test #14:

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

Test #15:

score: 5
Accepted
time: 46ms
memory: 11888kb

Test #16:

score: 5
Accepted
time: 43ms
memory: 11972kb

Test #17:

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

Test #18:

score: 5
Accepted
time: 5ms
memory: 14868kb

Test #19:

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

Test #20:

score: 5
Accepted
time: 84ms
memory: 27324kb

Extra Test:

score: 0
Extra Test Passed