Submission #332939

# Submission time Handle Problem Language Result Execution time Memory
332939 2020-12-04T03:15:02 Z Kevin_Zhang_TW Sweeping (JOI20_sweeping) C++17
1 / 100
18000 ms 18028 KB
#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 time Memory Grader output
1 Correct 12 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 11 ms 512 KB Output is correct
5 Correct 29 ms 492 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 18029 ms 18028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 18033 ms 15472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 18033 ms 15472 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 492 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 11 ms 512 KB Output is correct
5 Correct 29 ms 492 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Execution timed out 18029 ms 18028 KB Time limit exceeded
8 Halted 0 ms 0 KB -