답안 #727056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
727056 2023-04-20T01:54:45 Z SanguineChameleon 이상한 기계 (APIO19_strange_device) C++17
10 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

void just_do_it();

int main() {
	#ifdef KAMIRULEZ
		freopen("kamirulez.inp", "r", stdin);
		freopen("kamirulez.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	just_do_it();
	return 0;
}

const int maxN = 1e6 + 20;
const long long inf = 1e18L + 20;
long long L[maxN];
long long R[maxN];

void just_do_it() {
	int N;
	long long A, B;
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) {
		cin >> L[i] >> R[i];
	}
	if (A > inf / B) {
		long long res = 0;
		for (int i = 0; i < N; i++) {
			res += R[i] - L[i] + 1;
		}
		cout << res;
		return;
	}
	set<pair<long long, long long>> S;
	for (int i = 0; i < N; i++) {
		for (long long j = L[i]; j <= R[i]; j++) {
			S.insert({(j + (j / B)) % A, j % B});
		}
	}
	cout << S.size();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 41 ms 12456 KB Output is correct
3 Correct 73 ms 18164 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 7 ms 1236 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 34 ms 7048 KB Output is correct
16 Correct 27 ms 7192 KB Output is correct
17 Correct 70 ms 11824 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 3015 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 137 ms 32200 KB Output is correct
3 Correct 173 ms 31984 KB Output is correct
4 Correct 107 ms 30584 KB Output is correct
5 Execution timed out 5086 ms 78072 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 486 ms 78456 KB Output is correct
3 Runtime error 2073 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 486 ms 78456 KB Output is correct
3 Runtime error 2073 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 486 ms 78456 KB Output is correct
3 Runtime error 2073 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1277 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 41 ms 12456 KB Output is correct
3 Correct 73 ms 18164 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 7 ms 1236 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 34 ms 7048 KB Output is correct
16 Correct 27 ms 7192 KB Output is correct
17 Correct 70 ms 11824 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Runtime error 3015 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -