#include <bits/stdc++.h>
using namespace std;
#define int long long
int treeX[6000001];
int treeY[6000001];
int arrX[1500001];
int arrY[1500001];
int M;
void updatelazy(int qL,int qR,int qX,int *tree,int x=1,int L=1,int R=M){
if(qR<L or R<qL)return;
if(qL<=L and R<=qR){
tree[x] = max(tree[x],qX);
return;
}
int mid = (L+R)/2;
updatelazy(qL,qR,qX,tree,2*x,L,mid);
updatelazy(qL,qR,qX,tree,2*x+1,mid+1,R);
}
void propagate(int qX,int *arr,int *tree,int x=1,int L=1,int R=M){
if(qX<L or R<qX)return;
if(tree[x]){
if(L==R)arr[L]=max(arr[L],tree[x]);
else {
tree[2*x] = max(tree[2*x],tree[x]);
tree[2*x+1] = max(tree[2*x+1],tree[x]);
}
tree[x]=0;
}
if(L==R)return;
int mid = (L+R)/2;
propagate(qX,arr,tree,2*x,L,mid);
propagate(qX,arr,tree,2*x+1,mid+1,R);
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,q;
cin >> n >> m >> q;
vector<pair<int,int>> dusts(m+1);
for(int i=1;i<=m;i++)cin>>dusts[i].first>>dusts[i].second;
M = m;
for(int i=1;i<=m;i++){
updatelazy(i,i,dusts[i].first,treeX);
updatelazy(i,i,dusts[i].second,treeY);
}
for(int i=1;i<=q;i++){
int type;cin>>type;
if(type==1){
int x;cin>>x;
propagate(x,arrX,treeX);
propagate(x,arrY,treeY);
cout << arrX[x] << ' ' << arrY[x] << '\n';
} else if(type==2){
int l;cin>>l;
int last = m+1;
for(int jump=262144;jump;jump/=2){
if(last-jump<=0)continue;
propagate(last-jump,arrY,treeY);
if(arrY[last-jump]<=l)last-=jump;
}
if(last<=m)updatelazy(last,m,n-l,treeX);
} else {
int l;cin>>l;
int last = 0;
for(int jump=262144;jump;jump/=2){
if(last+jump>m)continue;
propagate(last+jump,arrX,treeX);
if(arrX[last+jump]<=l)last+=jump;
}
if(last)updatelazy(1,last,n-l,treeY);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1508 ms |
36440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1777 ms |
42320 KB |
Output is correct |
2 |
Correct |
1767 ms |
62256 KB |
Output is correct |
3 |
Correct |
1219 ms |
61268 KB |
Output is correct |
4 |
Correct |
1114 ms |
61912 KB |
Output is correct |
5 |
Correct |
1554 ms |
61904 KB |
Output is correct |
6 |
Correct |
1698 ms |
62040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1777 ms |
42320 KB |
Output is correct |
2 |
Correct |
1767 ms |
62256 KB |
Output is correct |
3 |
Correct |
1219 ms |
61268 KB |
Output is correct |
4 |
Correct |
1114 ms |
61912 KB |
Output is correct |
5 |
Correct |
1554 ms |
61904 KB |
Output is correct |
6 |
Correct |
1698 ms |
62040 KB |
Output is correct |
7 |
Incorrect |
1376 ms |
62292 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |