年矢每催,曦晖朗曜。
忘记所有琐事吧
在大海的边上
尽情地呼唤吧
唤醒内心的欢乐
我的梦想,我们的梦想,
划过额头的流星。
全球变暖特征明显,冰山会加快融化的速率。
明月几时有?把酒问青天。不知天上宫阙,今夕是何年。我欲乘风归去,又恐琼楼玉宇,高处不胜寒。起舞弄清影,何似在人间。
转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。
我常常追忆过去。
生命瞬间定格在脑海。我将背后的时间裁剪、折叠、蜷曲,揉捻成天上朵朵白云。
云朵之间亦有分别:积云厚重,而卷云飘渺。生命里震撼的场景掠过我的思绪便一生无法忘怀,而更为普通平常的记忆在时间的冲刷下只留下些许残骸。追忆宛如入梦,太过清楚则无法愉悦自己的幻想,过分模糊却又坠入虚无。只有薄雾间的山水,面纱下的女子,那恰到好处的朦胧,才能满足我对美的苛求。
追忆总在不经意间将我裹进泛黄的纸页里。分别又重聚的朋友,推倒又重建的街道,种种线索协助着我从一个具体的时刻出发沿时间的河逆流而上。曾经的日子无法重来,我只不过是一个过客。但我仍然渴望在每一次追忆之旅中留下闲暇时间,在一个场景前驻足,在岁月的朦胧里瞭望过去的自己,感受尽可能多的甜蜜。美好的时光曾流过我的身体,我便心满意足。
过去已经凝固,我带着回忆向前,只是时常疏于保管,回忆也在改变着各自的形态。这给我的追忆旅程带来些许挑战。
我该在哪里停留?我问我自己。
#include<bits/stdc++.h>
#include<unordered_map>
#include<vector>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<cmath>
#include<random>
#include<string>
#include<cstring>
#include<algorithm>
#include<bitset>
#define lc (x<<1)
#define rc (x<<1|1)
#define pii pair<int,int>
#define mkp make_pair
#define fi first
#define se second
#define cout cerr<<">> ",cout
using namespace std;
const int Mx=100005,B=433,p=998244353;
int read(){
int Alice=0,Aya=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') Aya=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
Alice=(Alice<<3)+(Alice<<1)+(ch^48);
ch=getchar();
}
return (Aya==1?Alice:-Alice);
}
int n,m,Q;
int val[Mx];//键值
int key[Mx];//权值
int invVal[Mx];
int invKey[Mx];
vector<int>e[Mx],inve[Mx];//图
struct Opt{
int typ;
int x,y;
int s,l,r;
int res;
}opt[Mx];
struct Qry{
int s,l,r;
int id;
bool operator <(const Qry&o)const{
return l==o.l?r<o.r:l<o.l;
}
};
vector<pii>apply;
bitset<Mx>aval[Mx];
int deg[Mx];
int mod[Mx];
bitset<B>sta[Mx];
void Calc(int L,int R){
for(int i=1;i<=n;i++) mod[i]=0,sta[i].reset();
for(int i=1;i<=n;i++) invVal[val[i]]=i,invKey[key[i]]=i;
vector<Qry>qry;
vector<int>cha;
for(int i=L;i<=R;i++){
if(opt[i].typ!=3){
mod[opt[i].x]=mod[opt[i].y]=1;
cha.push_back(opt[i].x);
cha.push_back(opt[i].y);
}
else{
qry.push_back({opt[i].s,opt[i].l,opt[i].r,i});
}
}
sort(qry.begin(),qry.end());
for(int i=0;i<(int)qry.size();i++){
sta[qry[i].s][i]=1;
//cout<<qry[i].s<<endl;
}
bitset<B>rem;
rem.reset();
for(int i=0;i<(int)qry.size();i++){
rem[i]=1;
}
for(pii _:apply){
int v=_.fi,u=_.se;
sta[v]|=sta[u];
}
vector<pii>vec((int)qry.size()*2);
for(int i=0;i<(int)qry.size();i++){
int l=qry[i].l,r=qry[i].r;
vec[i*2]={l,i};
vec[i*2+1]={r+1,i};
}
sort(vec.begin(),vec.end());
bitset<B>ok;
ok.reset();
int ptr=0;
for(int i=1;i<=n;i++){
while(ptr<(int)vec.size()&&vec[ptr].fi==i){
ok[vec[ptr].se]=1-ok[vec[ptr].se];
ptr++;
}
sta[invKey[i]]&=ok;
}
for(int I=n;I>=1;I--){
int i=invVal[I];
if(mod[i]) continue;
bitset<B>thi=sta[i]&rem;
int o=thi._Find_first();
while(o<B){
opt[qry[o].id].res=max(opt[qry[o].id].res,I);
o=thi._Find_next(o);
}
rem^=thi;
}
for(int i=L;i<=R;i++){
int x=opt[i].x,y=opt[i].y;
if(opt[i].typ==1){
swap(key[x],key[y]);
}
else if(opt[i].typ==2){
swap(val[x],val[y]);
}
else{
int u=opt[i].s,l=opt[i].l,r=opt[i].r,id=i,res=0;
for(int v:cha){
//cout<<u<<" "<<v<<" : "<<aval[u][v]<<" -> "<<id<<" : "<<val[v]<<endl;
if(key[v]<=r&&key[v]>=l&&aval[u][v]){
res=max(res,val[v]);
}
}
opt[id].res=max(opt[id].res,res);
}
}
}
void Solve(){
n=read(),m=read();
Q=read();
for(int i=1,u,v;i<=m;i++){
u=read(),v=read();
deg[u]++;
e[u].push_back(v);
inve[v].push_back(u);
}
for(int i=1;i<=n;i++){
key[i]=read();
invKey[key[i]]=i;
}
for(int i=1;i<=n;i++){
val[i]=read();
invVal[val[i]]=i;
}
queue<int>q;
for(int i=1;i<=n;i++) aval[i][i]=1;
for(int i=1;i<=n;i++) if(deg[i]==0){
q.push(i);
}
while(!q.empty()){
int u=q.front();
q.pop();
for(int v:inve[u]){
if(deg[v]==0) continue;
deg[v]--;
aval[v]|=aval[u];
if(deg[v]==0){
q.push(v);
}
}
}
for(int i=1;i<=n;i++) deg[i]=0;
for(int i=1;i<=n;i++){
for(int j:e[i]){
//cout<<i<<" "<<j<<endl;
deg[j]++;
}
}
for(int i=1;i<=n;i++) if(deg[i]==0){
q.push(i);
}
while(!q.empty()){
int u=q.front();
q.pop();
for(int v:e[u]){
if(deg[v]==0) continue;
deg[v]--;
apply.push_back({v,u});
if(deg[v]==0){
q.push(v);
}
}
}
for(int i=1,typ,s,l,r,x,y;i<=Q;i++){
typ=read();
l=r=s=x=y=0;
if(typ==1){
x=read(),y=read();
}
else if(typ==2){
x=read(),y=read();
}
else{
s=read(),l=read(),r=read();
}
opt[i]={typ,x,y,s,l,r,0};
}
for(int i=1;;i++){
Calc((i-1)*B+1,min(i*B,Q));
if(i*B>=Q) break;
}
for(int i=1;i<=Q;i++){
if(opt[i].typ==3) printf("%d\n",opt[i].res);
}
for(int i=1;i<=n;i++){
e[i].clear();
inve[i].clear();
aval[i].reset();
deg[i]=0;
}
apply.clear();
}
signed main(){
freopen("recall.in","r",stdin);
freopen("recall.out","w",stdout);
read();
int T=read();
while(T--) Solve();
return 0;
}
/*
Hello!!
Sample:
fc recall.out recall7.ans
---------------
*/
Of all the strange things that Alice saw in her journey Through the Looking-Glass, this was the one that she always remembered most clearly. Years afterwards she could bring the whole scene back again, as if it had been only yesterday —the mild blue eyes and kindly smile of the Knight — the setting sun gleaming through his hair, and shining on his armor in a blaze of light that quite dazzled her—the horse quietly moving about, with the reins hanging loose on his neck, cropping the grass at her feet—and the black shadows of the forest behind — all this she took in like a picture, as, with one hand shading her eyes, she leant against a tree, watching the strange pair, and listening, in a half-dream, to the melancholy music of the song.
全球变暖特征明显,冰山会加快融化的速率。
Oceanic Symphonia!!!
2024.12.15 737
MIA REVO,NIA REVO,
FALSTELO TRA FRUNTOJ.
明月几时有?把酒问青天。不知天上宫阙,今夕是何年。我欲乘风归去,又恐琼楼玉宇,高处不胜寒。起舞弄清影,何似在人间。
转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。
Alive Cartesian。
否则单调队列初始化成 , 写 。
这年代谁还手写单调队列,咍咍。
Alive Carrot。









