QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430598#8780. Training, Round 2ucup-team3591WA 3ms4232kbC++201.3kb2024-06-04 02:20:092024-06-04 02:20:09

Judging History

你现在查看的是最新测评结果

  • [2024-06-04 02:20:09]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4232kb
  • [2024-06-04 02:20:09]
  • 提交

answer

#include <bits/stdc++.h>
using i64 = long long;

inline void chkmax(int &a, const int &b) {if (a < b) a = b;}
inline void chkmin(int &a, const int &b) {if (a > b) a = b;}
constexpr int N = 5010;

int n, x, y;
std::set<int> pset[N];
std::set<std::pair<int, int>> st;

int main() {
#ifdef HeratinoNelofus
	freopen("input.txt", "r", stdin);
#endif
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	std::cin >> n >> x >> y;
	pset[0].insert(0);

	int ans = 0;
	auto check = [&](int p, int q) {
		return st.find(std::make_pair(p, q)) == st.end();
	};
	auto process = [&](int p, int q) {
		pset[p].erase(q);
		st.insert(std::make_pair(p, q));
		if (check(p + 1, q))
			pset[p + 1].insert(q);
		if (check(p, q + 1))
			pset[p].insert(q + 1);
		chkmax(ans, (p - x) + (q - y) + 1);
	};

	for (int i = 1; i <= n; i++) {
		int xl, xh, yl, yh;
		std::cin >> xl >> xh;
		std::cin >> yl >> yh;
		xl = std::max(xl - x, 0);
		xh = std::min(xh - x, n);
		yl = std::max(yl - y, 0);
		yh = std::min(yh - y, n);
		if (xl > xh || yl > yh)
			continue;
		for (int p = xl; p <= xh; p++) {
			auto qit = pset[p].lower_bound(yl);
			if (qit == pset[p].end())
				continue;
			int q = *qit;
			if (q > yh)
				continue;
			process(p, q);
		}
	}
	std::cout << ans << '\n';
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3716kb

input:

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 4232kb

input:

5000 801577551 932138594
801577551 801577551 932138594 932138594
801577552 801577552 932138594 932138594
801577552 801577552 932138595 932138595
801577552 801577552 932138596 932138596
801577553 801577553 932138596 932138596
801577553 801577553 932138597 932138597
801577553 801577553 932138598 93213...

output:

0

result:

wrong answer 1st lines differ - expected: '5000', found: '0'