#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
typedef long long ll;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
ll rand_int(ll l, ll r) { //[l, r]
#ifdef LOCAL
static mt19937_64 gen;
#else
static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
return uniform_int_distribution<ll>(l, r)(gen);
}
template <uint MD> struct ModInt {
using M = ModInt;
const static M G;
uint v;
ModInt(ll _v = 0) { set_v(_v % MD + MD); }
M& set_v(uint _v) {
v = (_v < MD) ? _v : _v - MD;
return *this;
}
explicit operator bool() const { return v != 0; }
M operator-() const { return M() - *this; }
M operator+(const M& r) const { return M().set_v(v + r.v); }
M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
M operator/(const M& r) const { return *this * r.inv(); }
M& operator+=(const M& r) { return *this = *this + r; }
M& operator-=(const M& r) { return *this = *this - r; }
M& operator*=(const M& r) { return *this = *this * r; }
M& operator/=(const M& r) { return *this = *this / r; }
bool operator==(const M& r) const { return v == r.v; }
M pow(ll n) const {
M x = *this, r = 1;
while (n) {
if (n & 1) r *= x;
x *= x;
n >>= 1;
}
return r;
}
M inv() const { return pow(MD - 2); }
friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;
template<> const Mint Mint::G = Mint(3);
#define N_ 1501000
struct Query{
int type;
int p, l;
int x, y;
}U[N_];
pii Ans[N_];
pii w[N_];
int L, vis[N_], Cur[N_];
priority_queue<pii, vector<pii> ,greater<pii> >PQX[N_], PQY[N_];
priority_queue<pii >PQX2[N_], PQY2[N_];
int MX[N_], MY[N_], Num[N_];
void DnC(int b, int e){
if(b==e)return;
int m = (b+e)>>1;
DnC(b,m);
DnC(m+1,e);
int cnt = 1;
MX[1]=MY[1]=0;
auto Put = [&](int nd, int idx){
PQX[nd].push({w[idx].fi,idx});
PQX2[nd].push({w[idx].fi,idx});
PQY[nd].push({w[idx].se,idx});
PQY2[nd].push({w[idx].se,idx});
Num[idx] = nd;
};
rng(i,b,m){
if(U[i].type == 4){
if(!vis[i]){
w[i] = {U[i].x,U[i].y};
vis[i] = 1;
}
Cur[i]=1;
Put(cnt, i);
Num[i] = cnt;
}
}
set<int>SX;
SX.insert(0);
SX.insert(L+1);
map<int,int>SM;
SM[0] = 1;
rng(i,m+1,e){
if(U[i].type==1){
int p = U[i].p;
if(Cur[p]){
Ans[i] = {max(w[p].fi, MX[Num[p]]), max(w[p].se, MY[Num[p]])};
}
}
if(U[i].type==2){ // x < L-l && y <=l -> (L-l, y)
int l = U[i].l;
if(SX.find(L-l) != SX.end())continue;
auto it2 = SX.lower_bound(L-l);
auto it1 = prev(it2);
int bx = *it1, ex = *it2;
int nd = SM[*it1];
vi Z1,Z2;
while(!PQY[nd].empty()){
while(1){
auto [y1, idx1] = PQY[nd].top();
if(Num[idx1] != nd){
PQY[nd].pop();
continue;
}
if(y1 > l){
cnt++;
SX.insert(L-l);
SM[L-l] = cnt;
MX[cnt] = L-l;
MY[cnt] = MY[nd];
for(auto &idx : Z1){
Put(cnt, idx);
}
for(auto &idx : Z2){
PQY2[nd].push({w[idx].se,idx});
}
break;
}
Z1.pb(idx1);
PQY[nd].pop();
break;
}
while(1){
auto [y2, idx2] = PQY2[nd].top();
if(Num[idx2] != nd){
PQY2[nd].pop();
continue;
}
if(y2 <= l){
cnt++;
SX.insert(L-l);
SM[L-l] = nd;
SM[bx] = cnt;
MX[cnt] = MX[nd];
MY[cnt] = MY[nd];
MX[nd] = L-l;
for(auto &idx : Z2){
Put(cnt, idx);
}
for(auto &idx : Z1){
PQY[nd].push({w[idx].se,idx});
}
break;
}
Z2.pb(idx2);
PQY2[nd].pop();
break;
}
}
}
if(U[i].type==3){
}
}
rng(i,b,m){
if(U[i].type == 4){
w[i].fi = max(w[i].fi, MX[Num[i]]);
w[i].se = max(w[i].se, MY[Num[i]]);
Cur[i]=0;
}
}
}
int RN[N_];
void Solve(){
int m, Q;
scanf("%d%d%d",&L,&m,&Q);
rng(i,1,m){
scanf("%d%d",&U[i].x,&U[i].y);
U[i].type = 4;
RN[i]=i;
}
int cc = m;
rng(i,m+1,m+Q){
scanf("%d",&U[i].type);
if(U[i].type == 1){
scanf("%d",&U[i].p);
U[i].p = RN[U[i].p];
}
if(U[i].type == 2){
scanf("%d",&U[i].l);
}
if(U[i].type == 3){
scanf("%d",&U[i].l);
}
if(U[i].type == 4){
RN[++cc] = i;
scanf("%d%d",&U[i].x,&U[i].y);
}
}
DnC(1,m+Q);
rng(i,1,m+Q){
if(U[i].type==1)printf("%d %d\n",Ans[i].fi,Ans[i].se);
}
}
int main(){
int TC=1;
//scanf("%d",&TC);
while(TC--){
Solve();
}
}
Compilation message
sweeping.cpp: In function 'void DnC(int, int)':
sweeping.cpp:135:28: warning: unused variable 'ex' [-Wunused-variable]
135 | int bx = *it1, ex = *it2;
| ^~
sweeping.cpp: In function 'void Solve()':
sweeping.cpp:211:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
211 | scanf("%d%d%d",&L,&m,&Q);
| ~~~~~^~~~~~~~~~~~~~~~~~~
sweeping.cpp:213:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
213 | scanf("%d%d",&U[i].x,&U[i].y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sweeping.cpp:219:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
219 | scanf("%d",&U[i].type);
| ~~~~~^~~~~~~~~~~~~~~~~
sweeping.cpp:221:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
221 | scanf("%d",&U[i].p);
| ~~~~~^~~~~~~~~~~~~~
sweeping.cpp:225:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
225 | scanf("%d",&U[i].l);
| ~~~~~^~~~~~~~~~~~~~
sweeping.cpp:228:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
228 | scanf("%d",&U[i].l);
| ~~~~~^~~~~~~~~~~~~~
sweeping.cpp:232:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
232 | scanf("%d%d",&U[i].x,&U[i].y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
91 ms |
189780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
7118 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5094 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5094 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
91 ms |
189780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |