QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#488517#9155. 集合qwqUwU_100 ✓324ms57100kbC++171.8kb2024-07-24 09:25:172024-07-24 09:25:17

Judging History

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

  • [2024-07-24 09:25:17]
  • 评测
  • 测评结果:100
  • 用时:324ms
  • 内存:57100kb
  • [2024-07-24 09:25:17]
  • 提交

answer

// clang-format off
#include<bits/stdc++.h>
#define pb push_back
#define P make_pair
#define fi first
#define se second
#define bit(s,x) (((s)>>(x))&1)
#define pnp(s) __builtin_popcountll(s)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long ll; 
typedef unsigned long long ull; 
typedef pair<int,int> pii; typedef pair<ll,int> pli; typedef pair<ll,ll> pll; typedef pair<int,ll> pil;
inline ll read(){
	ll x=0,f=1,c=getchar();
	while(c<'0'||c>'9')f=(c=='-'?-1:1),c=getchar();
	while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
const int N=2e5+3;
const int M=6e5+3;
const int mod=998244353;
inline void Ad(int &x,int y){x=x+y>=mod?x+y-mod:x+y;}
inline void Mi(int &x,int y){x=x-y<0?x-y+mod:x-y;}
// clang-format on
int n,m,q,lim[N];
int p2[N],a[M],b[M],cnt=0;
unordered_map<int,int>mp;
inline void add(int x,int k){
	if(mp[x]==0)++cnt;
	mp[x]+=k;
	if(mp[x]==0)--cnt;
}
int A[N][3],B[N][3];
int main() {
    //freopen("data.in", "r", stdin);
    // freopen(".in","r",stdin);
    // freopen("myans.out","w",stdout);
	n=read(),m=read(),q=read();
	p2[0]=1;rep(i,1,n)p2[i]=2ll*p2[i-1]%mod;
	rep(i,1,n)rep(d,0,2)A[i][d]=read();
	rep(i,1,n)rep(d,0,2)B[i][d]=read();
	int l=1;
	rep(r,1,n){
		rep(d,0,2){
			int x=A[r][d];
			add(a[x],-1);
			Ad(a[x],p2[r]);
			add(a[x],1);
		}
		rep(d,0,2){
			int x=B[r][d];
			add(b[x],1);
			Ad(b[x],p2[r]);
			add(b[x],-1);
		}
		while(cnt!=0){
			rep(d,0,2){
				int x=A[l][d];
				add(a[x],-1);
				Mi(a[x],p2[l]);
				add(a[x],1);
			}
			rep(d,0,2){
				int x=B[l][d];
				add(b[x],1);
				Mi(b[x],p2[l]);
				add(b[x],-1);
			}
			++l;
		}
		lim[r]=l;
	}
	while(q--){
		int l=read(),r=read();
		if(lim[r]<=l)printf("Yes\n");
		else printf("No\n");
	}
    return 0;
}

Details


Pretests

Pretest #1:

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

Pretest #2:

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

Pretest #3:

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

Pretest #4:

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

Pretest #5:

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

Pretest #6:

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

Pretest #7:

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

Pretest #8:

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

Pretest #9:

score: 5
Accepted
time: 11ms
memory: 7908kb

Pretest #10:

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

Pretest #11:

score: 5
Accepted
time: 253ms
memory: 57100kb

Pretest #12:

score: 5
Accepted
time: 224ms
memory: 54896kb

Pretest #13:

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

Pretest #14:

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

Pretest #15:

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

Pretest #16:

score: 5
Accepted
time: 52ms
memory: 10500kb

Pretest #17:

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

Pretest #18:

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

Pretest #19:

score: 5
Accepted
time: 324ms
memory: 53556kb

Pretest #20:

score: 5
Accepted
time: 301ms
memory: 53064kb

Final Tests

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

score: 5
Accepted
time: 221ms
memory: 55248kb

Test #12:

score: 5
Accepted
time: 243ms
memory: 52856kb

Test #13:

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

Test #14:

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

Test #15:

score: 5
Accepted
time: 54ms
memory: 10496kb

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

score: 5
Accepted
time: 289ms
memory: 54520kb

Test #20:

score: 5
Accepted
time: 288ms
memory: 53436kb

Extra Test:

score: 0
Extra Test Passed