Submission #332939

#TimeUsernameProblemLanguageResultExecution timeMemory
332939Kevin_Zhang_TWSweeping (JOI20_sweeping)C++17
1 / 100
18033 ms18028 KiB
#include<bits/stdc++.h> #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmax(T &val, T nv) { return val < nv ? (val = nv, true) : false; } template<class T> bool chmin(T &val, T nv) { return nv < val ? (val = nv, true) : false; } using namespace std; using ll = long long; #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void debug(auto L, auto R) { while (L < R) cerr << *L << " \n"[L+1==R], ++L; } void kout(){ cerr << endl; } template<class T1, class ...T2> void kout(T1 a, T2 ...e) { cerr << a << ' ', kout(e...); } #else #define DE(...) 0 #define debug(...) 0 #endif // What I should check // 1. overflow // 2. corner cases // Enjoy the problem instead of hurrying to AC // Good luck ! const int MAX_N = 300010; int n, m, q; vector<pair<int,int>> dust; pair<int,int> qry(int id) { return dust[id]; } // increase x, move to right void doH(int L) { for (auto &[x, y] : dust) if (y <= L) chmax(x, n - L); } // increase y, move to up void doV(int L) { for (auto &[x, y] : dust) if (x <= L) chmax(y, n - L); } void add_dust(int x, int y) { dust.pb(x, y); } int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> m >> q; dust.resize(m); for (auto &[x, y] : dust) cin >> x >> y; for (int i = 0, t, id, L, x, y;i < q;++i) { cin >> t; // qry dust id if (t == 1) { cin >> id; tie(x, y) = qry(id - 1); cout << x << ' ' << y << '\n'; } // do H if (t == 2) { cin >> L; doH(L); } // do V if (t == 3) { cin >> L; doV(L); } // add dust if (t == 4) { cin >> x >> y; add_dust(x, y); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...