답안 #799972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799972 2023-08-01T08:58:40 Z 박상훈(#10082) 청소 (JOI20_sweeping) C++17
1 / 100
18000 ms 21724 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;
typedef long long ll;

constexpr int MAXN = 1501500;
constexpr int MAXQ = 1001000;

ll D;
int n, q;

ll X[MAXN], Y[MAXN];

int op[MAXQ];
pair<ll, ll> ans[MAXQ];

void naive(){
	for (int i=1;i<=q;i++){
		cin >> op[i];
		ll x, y;
		if (op[i]==1){
			cin >> x;
			ans[i] = {X[x], Y[x]};
		}

		else if (op[i]==2){
			cin >> x;
			for (int j=1;j<=n;j++) if (X[j] < D-x && Y[j] <= x) X[j] = D-x;
		}

		else if (op[i]==3){
			cin >> x;
			for (int j=1;j<=n;j++) if (X[j] <= x && Y[j] < D-x) Y[j] = D-x;
		}

		else{
			cin >> x >> y;
			++n;
			X[n] = x, Y[n] = y;
		}
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> D >> n >> q;
	for (int i=1;i<=n;i++) cin >> X[i] >> Y[i];

	naive();
	for (int i=1;i<=q;i++) if (op[i]==1) printf("%lld %lld\n", ans[i].first, ans[i].second);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 596 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 8 ms 604 KB Output is correct
5 Correct 21 ms 484 KB Output is correct
6 Correct 4 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18027 ms 18932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18040 ms 21724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18040 ms 21724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 596 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 8 ms 604 KB Output is correct
5 Correct 21 ms 484 KB Output is correct
6 Correct 4 ms 500 KB Output is correct
7 Execution timed out 18027 ms 18932 KB Time limit exceeded
8 Halted 0 ms 0 KB -