QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#429807#8338. Quad Kingdoms Chessushg8877WA 56ms22204kbC++141.2kb2024-06-02 21:20:392024-06-02 21:20:40

Judging History

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

  • [2024-06-02 21:20:40]
  • 评测
  • 测评结果:WA
  • 用时:56ms
  • 内存:22204kb
  • [2024-06-02 21:20:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
mt19937 rnd(time(0));
const int MAXN=1e5+5;
ll val[MAXN];
int n=100000;
struct segt{
int mn[MAXN<<2],mx[MAXN<<2];ll hs[MAXN<<2],hsl[MAXN<<2];
ll get_hs(int x,int id){
	if(x>mn[id]) return 0;
	if(x<=mn[id]) return hs[id];
	if(x<=mx[id<<1|1]) return get_hs(x,id<<1|1)+hsl[id];
	return get_hs(x,id);
}
void pushup(int id){
	mx[id]=max(mx[id<<1],mx[id<<1|1]);
	mn[id]=min(mn[id<<1],mn[id<<1|1]);
	hsl[id]=get_hs(mx[id<<1|1],id<<1);
	hs[id]=hs[id<<1|1]+hsl[id];
}
void upd(int x,int v,int id=1,int l=1,int r=n){
	if(l==r){
		mn[id]=mx[id]=v;hs[id]=val[v];hsl[id]=0;
		return;
	}
	int mid=(l+r)>>1;
	if(x<=mid) upd(x,v,id<<1,l,mid);
	else upd(x,v,id<<1|1,mid+1,r);
	pushup(id);
}
}T[2];
int main(){
	ios::sync_with_stdio(false);
	// freopen("Otomachi_Una.in","r",stdin);
	// freopen("Otomachi_Una.out","w",stdout);
	for(int i=1;i<MAXN;i++) val[i]=rnd();
	for(int o:{0,1}){
		int n;cin>>n;
		for(int i=1;i<=n;i++){
			int x;cin>>x;
			T[o].upd(i,x);
		}
	}
	int q;cin>>q;
	while(q--){
		int o,x,y;cin>>o>>x>>y;
		T[o-1].upd(x,y);
		cout<<(T[0].hs[1]==T[1].hs[1]?"YES":"NO")<<'\n';
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 22204kb

input:

5
1 2 3 4 5
5
5 4 3 2 1
8
1 1 5
1 4 2
1 2 4
1 5 1
1 5 5
2 1 4
2 3 5
2 5 5

output:

NO
NO
NO
YES
NO
NO
NO
YES

result:

ok 8 tokens

Test #2:

score: -100
Wrong Answer
time: 56ms
memory: 20928kb

input:

1
2
6
2 1 1 1 1 1
200000
2 6 2
1 1 1
1 1 1
1 1 2
2 1 1
1 1 2
1 1 1
2 4 1
2 1 2
1 1 1
1 1 2
2 5 1
1 1 1
1 1 2
1 1 1
2 6 1
1 1 2
1 1 2
1 1 2
2 3 1
1 1 1
2 1 1
2 6 2
1 1 2
2 4 1
1 1 2
2 6 1
1 1 2
1 1 1
2 5 2
2 6 2
1 1 1
2 4 2
2 5 2
2 6 2
1 1 1
2 5 1
2 6 2
1 1 2
1 1 1
1 1 1
2 4 1
1 1 2
1 1 2
1 1 2
2 3 2...

output:

YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
N...

result:

wrong answer 1st words differ - expected: 'NO', found: 'YES'