# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
958274 | Vladth11 | 청소 (JOI20_sweeping) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#define int ll
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
const ll NMAX = 500001;
const ll INF = 1e9;
const ll nrbits = 20;
const ll MOD = 998244353;
signed main() {
#ifdef HOME
ifstream cin(".in");
ofstream cout(".out");
#endif // HOME
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector <pii> v;
int n, m, q, i, oke = 1;
cin >> n >> m >> q;
for(i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
if(v.size() && (a < v.back().first || b > v.back().second)){
oke = 0;
}
v.push_back({a, b});
}
while(q--) {
int t;
cin >> t;
if(t == 4) {
int a, b;
cin >> a >> b;
v.push_back({a, b});
} else if(t == 1) {
int x;
cin >> x;
cout << v[x - 1].first << " " << v[x - 1].second << "\n";
} else if(t == 2) {
int l;
cin >> l;
for(auto &x : v) {
if(x.second <= l)
x.first = max(x.first, n - l);
}
} else {
int l;
cin >> l;
for(auto &x : v) {
if(x.first <= l)
x.second = max(x.second, n - l);
}
}
}
return 0;
}
if(oke == 1){
build(1, 1, m);
for(int i = 1; i <= q; i++){
int t;
cin >> t;
if(t == 1){
pii x = afla(1, 1, m, i);
cout << x.first << " " << x.second << "\n";
}else if(t == 2){
int unde = searchY(l);
if(l >= 1)
addMaximX(1, 1, n, 1, l);
}else{
int unde = searchX(l);
if(l >= 1)
addMaximY(1, 1, n, 1, l);
}
}
return 0;
}