Submission #74089382


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int l, r, u, v;

int main() {
	cin >> l >> r >> u >> v;
	ll ans = (l <= 0 && 0 <= r && u <= 0 && 0 <= v);
	for (int i = 1 ; i <= 1e6 ; i++) {
		if (u <= 2 * i && 2 * i <= v) {
			int x = max(l, -2 * i + 1), y = min(r, 2 * i - 1);
			ans += max(y - x + 1, 0);
		}
		if (u <= -2 * i && -2 * i <= v) {
			int x = max(l, -2 * i + 1), y = min(r, 2 * i - 1);
			ans += max(y - x + 1, 0);
		}
		if (l <= -2 * i && -2 * i <= r) {
			int x = max(u, -2 * i), y = min(v, 2 * i);
			ans += max(y - x + 1, 0);
		}
		if (l <= 2 * i && 2 * i <= r) {
			int x = max(u, -2 * i), y = min(v, 2 * i);
			ans += max(y - x + 1, 0);
		}
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task D - Make Target 2
User dongzirui0817
Language C++ IOI-Style(GNU++20) (GCC 14.2.0)
Score 425
Code Size 749 Byte
Status AC
Exec Time 2 ms
Memory 1704 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 2
AC × 29
Set Name Test Cases
Sample sample00.txt, sample01.txt
All sample00.txt, sample01.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt
Case Name Status Exec Time Memory
sample00.txt AC 2 ms 1704 KiB
sample01.txt AC 1 ms 1704 KiB
testcase00.txt AC 2 ms 1704 KiB
testcase01.txt AC 2 ms 1704 KiB
testcase02.txt AC 2 ms 1704 KiB
testcase03.txt AC 1 ms 1704 KiB
testcase04.txt AC 2 ms 1704 KiB
testcase05.txt AC 2 ms 1704 KiB
testcase06.txt AC 1 ms 1704 KiB
testcase07.txt AC 2 ms 1704 KiB
testcase08.txt AC 1 ms 1704 KiB
testcase09.txt AC 2 ms 1704 KiB
testcase10.txt AC 2 ms 1704 KiB
testcase11.txt AC 2 ms 1704 KiB
testcase12.txt AC 2 ms 1704 KiB
testcase13.txt AC 1 ms 1704 KiB
testcase14.txt AC 1 ms 1704 KiB
testcase15.txt AC 2 ms 1704 KiB
testcase16.txt AC 2 ms 1704 KiB
testcase17.txt AC 2 ms 1704 KiB
testcase18.txt AC 2 ms 1704 KiB
testcase19.txt AC 2 ms 1704 KiB
testcase20.txt AC 2 ms 1704 KiB
testcase21.txt AC 2 ms 1704 KiB
testcase22.txt AC 1 ms 1704 KiB
testcase23.txt AC 2 ms 1704 KiB
testcase24.txt AC 1 ms 1704 KiB
testcase25.txt AC 2 ms 1704 KiB
testcase26.txt AC 2 ms 1704 KiB