QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#525500#9155. 集合zhenjianuo2025100 ✓213ms55356kbC++142.6kb2024-08-20 17:14:262024-08-20 17:14:27

Judging History

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

  • [2024-08-20 17:14:27]
  • 评测
  • 测评结果:100
  • 用时:213ms
  • 内存:55356kb
  • [2024-08-20 17:14:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#define fi first
#define se second
#define ins insert
#define it iterator
#define lb lower_bound
#define ub upper_bound
#define exc(exp) if(exp)continue;
#define ret(exp) if(exp)return;
#define stop(exp) if(exp)break;
#define quit(sth) {sth;return;}
#define let(var...) int var;tie(var)
#define siz(vec) ((int)((vec).size()))
#define all(vec) (vec).begin(),(vec).end()
#define unq(vec) sort(all(vec)),(vec).erase(unique(all(vec)),(vec).end())
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define debl(var) cerr<<#var<<'='<<(var)<<";\n"
#define db double
#define ll long long
#define int long long
#define ull unsigned long long
#define inf (long long)(1e18)
mt19937_64 gen(random_device{}());
bool Max(int &x,int y){if(x<y)return x=y,1;return 0;}
bool Min(int &x,int y){if(x>y)return x=y,1;return 0;}
const int mod=998244353;
void Add(int &x,int y){x=x+y<mod?x+y:x+y-mod;}
int add(int x,int y){return x+y<mod?x+y:x+y-mod;}
int fpm(int x,int y){
	int ans=1;for(;y;y>>=1,(x*=x)%=mod)if(y&1)(ans*=x)%=mod;return ans;
}

int n,m,q,a[200010][3],b[200010][3],w[200010][20];

ull xo[200010],hsha[600010],hshb[600010],suma,sumb;
void work(){
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
    for(int i=1;i<=n;i++)cin>>b[i][0]>>b[i][1]>>b[i][2];

    for(int i=1,j=1;i<=n;i++){
        xo[i]=gen();
        for(int k=0;k<3;k++){
            int x=a[i][k],y=b[i][k];
            suma-=hsha[x],suma+=hsha[x]^=xo[i];
            sumb-=hshb[y],sumb+=hshb[y]^=xo[i];
        }
        while(j<=i&&suma!=sumb){
            for(int k=0;k<3;k++){
                int x=a[j][k],y=b[j][k];
                suma-=hsha[x],suma+=hsha[x]^=xo[j];
                sumb-=hshb[y],sumb+=hshb[y]^=xo[j];
            }                                               j++;
        }                           w[i][0]=j;
    }
    for(int k=1;k<20;k++){
        for(int i=1;i+(1<<k)-1<=n;i++)
            w[i][k]=max(w[i][k-1],w[i+(1<<(k-1))][k-1]);
    }
    while(q--){
        int l,r;
        cin>>l>>r;
        int lg=__lg(r-l+1);
        cout<<(max(w[l][lg],w[r-(1<<lg)+1][lg])<=l?"Yes\n":"No\n");
    }
}
signed main(){
	ios::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
	int T=1;while(T--)work();
}
/*
 * CONTINUE, NON-STOPPING, FOR THE FAITH
 * START TYPING IF YOU DON'T KNOW WHAT TO DO
 * STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
 */

Details


Pretests

Pretest #1:

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

Pretest #2:

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

Pretest #3:

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

Pretest #4:

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

Pretest #5:

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

Pretest #6:

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

Pretest #7:

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

Pretest #8:

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

Pretest #9:

score: 5
Accepted
time: 16ms
memory: 11824kb

Pretest #10:

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

Pretest #11:

score: 5
Accepted
time: 67ms
memory: 45980kb

Pretest #12:

score: 5
Accepted
time: 74ms
memory: 47928kb

Pretest #13:

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

Pretest #14:

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

Pretest #15:

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

Pretest #16:

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

Pretest #17:

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

Pretest #18:

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

Pretest #19:

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

Pretest #20:

score: 5
Accepted
time: 213ms
memory: 55356kb

Final Tests

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

score: 5
Accepted
time: 16ms
memory: 11740kb

Test #11:

score: 5
Accepted
time: 76ms
memory: 47396kb

Test #12:

score: 5
Accepted
time: 74ms
memory: 46500kb

Test #13:

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

Test #14:

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

Test #15:

score: 5
Accepted
time: 99ms
memory: 11832kb

Test #16:

score: 5
Accepted
time: 100ms
memory: 11824kb

Test #17:

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

Test #18:

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

Test #19:

score: 5
Accepted
time: 199ms
memory: 45820kb

Test #20:

score: 5
Accepted
time: 202ms
memory: 55172kb

Extra Test:

score: 0
Extra Test Passed