QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#493008#9155. 集合zeq2021100 ✓422ms63224kbC++142.7kb2024-07-26 18:29:522024-07-26 18:29:53

Judging History

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

  • [2024-07-26 18:29:53]
  • 评测
  • 测评结果:100
  • 用时:422ms
  • 内存:63224kb
  • [2024-07-26 18:29:52]
  • 提交

answer

/*
*            /$$           /$$
*           |__/          |__/
*  /$$$$$$$$ /$$ /$$$$$$$$ /$$  /$$$$$$
* |____ /$$/| $$|____ /$$/| $$ /$$__  $$
*    /$$$$/ | $$   /$$$$/ | $$| $$  \ $$
*   /$$__/  | $$  /$$__/  | $$| $$  | $$
*  /$$$$$$$$| $$ /$$$$$$$$| $$|  $$$$$$$
* |________/|__/|________/|__/ \____  $$
*                                   | $$
*                                   | $$
*                                   |__/
*/
//hj23308保佑我
//Missile保佑我
/*
* 醒了在梦里挣扎,不觉黯淡了朝霞
*/
/*
* 我很高兴你没有忘了我,但是我现在更希望你已经忘了我了。
* 希望在你的记忆中,我只是尘土一撮,从你的全世界路过,然后四散飞扬不留下一点痕迹,而你要不回头的往前走。
* 我更希望我只是从你的全世界路过,只是路过
*/
/*
* 只是我在十字路口守了太久,守到黄沙如雨掩埋一切痕迹,才发现自己等的人已经离开了。
*/
/*
* 听我的 别回头 回头就可能会泪流满面,会被黄沙掩埋,所以即使痛苦也要向前走
*/
/*
* 我听到了「天行健」的回响,这是一个伟大斗士的不息自强;
* 我听到了「破万法」的回响,这是一个黑道打手的守护欲望;
* 我看见了「生生不息」的激荡,这是一个骗子的伟大乐章!
*/
/*
* 我用虚假的面具照顾着细腻的感情;
* 我以华丽的衣物下藏着腐烂的血肉;
* 当我摘下面具,褪去衣物,即便是我最亲近的人,也无法直视我
*/
#include<bits/stdc++.h>
#define ull unsigned long long 
#define ll long long
using namespace std;
const int MAXN=6e5+5;
mt19937_64 rnd(1ull*time(0));
int n,m,q,sum;
ull Hsh[MAXN],A[MAXN],B[MAXN];
int a[MAXN][3],b[MAXN][3],p[MAXN];
unordered_map<ull,int>Map;
void insert(ull site,int type)
{
	if(Map[site]) sum--;
	Map[site]+=type;
	if(Map[site]) sum++;
}
void change(int site)
{
	for(int i=0;i<3;i++) {
		insert(A[a[site][i]],-1);
		A[a[site][i]]^=Hsh[site];
		insert(A[a[site][i]],1);
		insert(B[b[site][i]],1);
		B[b[site][i]]^=Hsh[site];
		insert(B[b[site][i]],-1);
	}
}
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	std::ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<3;j++) {
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;i++) {
		for(int j=0;j<3;j++) {
			cin>>b[i][j];
		}
	}
	for(int i=1;i<=n;i++) {
		Hsh[i]=rnd();
	}
	for(int l=1,r=0;l<=n;l++) {
		while(r<=n&&sum==0) {
			change(++r);
		}
		p[l]=r;
		change(l);
	}
	for(int i=1;i<=q;i++) {
		int l,r;
		cin>>l>>r;
		if(p[l]>r) {
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}
	return 0;
}

Details


Pretests

Pretest #1:

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

Pretest #2:

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

Pretest #3:

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

Pretest #4:

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

Pretest #5:

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

Pretest #6:

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

Pretest #7:

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

Pretest #8:

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

Pretest #9:

score: 5
Accepted
time: 19ms
memory: 9864kb

Pretest #10:

score: 5
Accepted
time: 17ms
memory: 9852kb

Pretest #11:

score: 5
Accepted
time: 283ms
memory: 59396kb

Pretest #12:

score: 5
Accepted
time: 285ms
memory: 60904kb

Pretest #13:

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

Pretest #14:

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

Pretest #15:

score: 5
Accepted
time: 106ms
memory: 10260kb

Pretest #16:

score: 5
Accepted
time: 103ms
memory: 10316kb

Pretest #17:

score: 5
Accepted
time: 21ms
memory: 16184kb

Pretest #18:

score: 5
Accepted
time: 17ms
memory: 17052kb

Pretest #19:

score: 5
Accepted
time: 393ms
memory: 61104kb

Pretest #20:

score: 5
Accepted
time: 386ms
memory: 62968kb

Final Tests

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

score: 5
Accepted
time: 12ms
memory: 9888kb

Test #10:

score: 5
Accepted
time: 20ms
memory: 9816kb

Test #11:

score: 5
Accepted
time: 274ms
memory: 59296kb

Test #12:

score: 5
Accepted
time: 279ms
memory: 59372kb

Test #13:

score: 5
Accepted
time: 3ms
memory: 10380kb

Test #14:

score: 5
Accepted
time: 3ms
memory: 10268kb

Test #15:

score: 5
Accepted
time: 101ms
memory: 10192kb

Test #16:

score: 5
Accepted
time: 102ms
memory: 10296kb

Test #17:

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

Test #18:

score: 5
Accepted
time: 14ms
memory: 15056kb

Test #19:

score: 5
Accepted
time: 384ms
memory: 60500kb

Test #20:

score: 5
Accepted
time: 422ms
memory: 63224kb

Extra Test:

score: 0
Extra Test Passed