Submission #71810265


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>

template <typename T>
bool chmax(T &x, T y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

long op_min(long x, long y) { return min(x, y); }
long op_max(long x, long y) { return max(x, y); }
constexpr long INF = 1e18;
long e_min() { return INF; }
long e_max() { return -INF; }

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n, que;
	cin >> n >> que;
	vector<long> u(n), v(n);
	for (int i = 0; i < n; i++) {
		long x, y;
		cin >> x >> y;
		u[i] = x + y, v[i] = x - y;
	}
	atcoder::segtree<long, op_min, e_min> u_min(u), v_min(v);
	atcoder::segtree<long, op_max, e_max> u_max(u), v_max(v);
	while (que--) {
		int ty;
		cin >> ty;
		if (ty == 1) {
			int i;
			long x, y;
			cin >> i >> x >> y;
			i--;
			u[i] = x + y, v[i] = x - y;
			u_min.set(i, u[i]);
			v_min.set(i, v[i]);
			u_max.set(i, u[i]);
			v_max.set(i, v[i]);
		} else {
			int l, r;
			long x, y;
			cin >> l >> r >> x >> y;
			l--;
			long u0 = x + y, v0 = x - y;
			long ans = 0;
			chmax(ans, abs(u0 - u_min.prod(l, r)));
			chmax(ans, abs(v0 - v_min.prod(l, r)));
			chmax(ans, abs(u0 - u_max.prod(l, r)));
			chmax(ans, abs(v0 - v_max.prod(l, r)));
			cout << ans << '\n';
		}
	}
}

Submission Info

Submission Time
Task F - Manhattan Christmas Tree 2
User sounansya
Language C++23 (GCC 15.2.0)
Score 500
Code Size 1316 Byte
Status AC
Exec Time 162 ms
Memory 23004 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 24
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3612 KiB
00_sample_01.txt AC 1 ms 3620 KiB
01_random_00.txt AC 158 ms 22752 KiB
01_random_01.txt AC 158 ms 22868 KiB
01_random_02.txt AC 156 ms 22864 KiB
01_random_03.txt AC 157 ms 22868 KiB
01_random_04.txt AC 156 ms 22720 KiB
01_random_05.txt AC 157 ms 22752 KiB
01_random_06.txt AC 156 ms 22956 KiB
01_random_07.txt AC 155 ms 22892 KiB
01_random_08.txt AC 155 ms 22892 KiB
01_random_09.txt AC 155 ms 22752 KiB
01_random_10.txt AC 111 ms 22936 KiB
01_random_11.txt AC 112 ms 23004 KiB
01_random_12.txt AC 112 ms 22904 KiB
01_random_13.txt AC 112 ms 22904 KiB
01_random_14.txt AC 112 ms 22752 KiB
01_random_15.txt AC 38 ms 3612 KiB
01_random_16.txt AC 60 ms 22892 KiB
01_random_17.txt AC 162 ms 22860 KiB
01_random_18.txt AC 161 ms 22904 KiB
01_random_19.txt AC 161 ms 22936 KiB
01_random_20.txt AC 161 ms 22892 KiB
01_random_21.txt AC 160 ms 22860 KiB