跳到正文

orzhhh

1053642

大橘猫喵是我儿纸

在洛谷打开
资料、奖项与版本

资料

编号
1053642
抓取

奖项

2024 CSP-J
二等奖
260 分 · 第 4492 名

2024-09-05 升绿祭

2025-02-22 提交999/1000祭

2025-05-17 绿钩祭

2025-05-19 橙名祭

树状数组套线段树

sece42.github.io

https://apps.ak-ioi.com/oi-2048/

943c60e9//1b1b//4693//ab28//b26069a73e13

943c60e9-1b1b-4693-ab28-b26069a73e13

https://www.meegames.com/zh/category/shooting/

C++
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn=2e5+10;
ll n,m,a[maxn],h[maxn],ht,l,r,lastans,rt[maxn],lc[maxn*24],rc[maxn*24],cnt;
unsigned ll s1[maxn*24],s2[maxn*24],s3[maxn*24];
void modify(ll &p,ll q,ll l,ll r,ll x)
{
	p=++cnt;
	if(l==r)
	{
		if(!s1[q]) s1[p]=x,s2[p]=x*x,s3[p]=x*x*x;
		return;
	}
	ll mid=l+r>>1;
	lc[p]=lc[q]; rc[p]=rc[q];
	if(x<=mid) modify(lc[p],lc[q],l,mid,x);
	else modify(rc[p],rc[q],mid+1,r,x);
	s1[p]=s1[lc[p]]+s1[rc[p]];
	s2[p]=s2[lc[p]]+s2[rc[p]];
	s3[p]=s3[lc[p]]+s3[rc[p]];
}
ll query(ll p,ll q,ll l,ll r)
{
	if(l==r)
	{
		if(s1[p]==s1[q]&&s2[p]==s2[q]&&s3[p]==s3[q]) return 0;
		return l;
	}
	ll mid=l+r>>1;
	if(s1[lc[p]]==s1[lc[q]]&&s2[lc[p]]==s2[lc[q]]&&s3[lc[p]]==s3[lc[q]]) return query(rc[p],rc[q],mid+1,r);
	return query(lc[p],lc[q],l,mid);
}
int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		h[++ht]=a[i];
	}
	sort(h+1,h+1+ht);
	ht=unique(h+1,h+1+ht)-h-1;
	for(ll i=1;i<=n;i++)
	{
		a[i]=lower_bound(h+1,h+1+ht,a[i])-h;
		modify(rt[i],rt[i-1],1,ht,a[i]);
	}
	scanf("%lld",&m);
	while(m--)
	{
		scanf("%lld%lld",&l,&r);
		l^=lastans; r^=lastans;
		printf("%lld\n",lastans=h[query(rt[r],rt[l-1],1,ht)]);
	}
	return 0;
}

T2

RNGdle ? 800839

? MYTHIC • Top 0%

? ? 8008 ? ?️ Deep Void ? ? Pocket Mirror +11 more

340,997 EP https://rngdle.com

RNGdle ? 691337

? MYTHIC • Top 0%

? ? Leet ? ? Nice ? ? Prime Number +12 more

339,479 EP https://rngdle.com

RNGdle ? 2557

? MYTHIC • Top 1%

? ?️ Framed Pair ? ? Steps ? ? Four Digits +10 more

172,420 EP https://rngdle.com

RNGdle ? 596000

? ANOMALY • Top 1%

? ?️ Millennium ? ? Deep Void (3) ? ? Century +17 more

RNGdle ? 777745

? MYTHIC • Top 0%

? ?? Jackpot Four ? ➖➖ Contiguous Quads ? ? Jackpot +19 more

414,056 EP https://rngdle.com

还没有收录这位用户的文章。