# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124433 | AyaBenSaad | Strange Device (APIO19_strange_device) | C++14 | 5077 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
// sub 4
using namespace std;
const int M = 2e6 + 6;
int n;
ll a, b;
ll l[M], r[M];
set <pair <ll, ll> >s;
int main () {
scanf ("%d %lld %lld", &n, &a, &b);
for (int i = 0; i < n; i++) {
scanf("%lld %lld", &l[i], &r[i]);
for (long long j = l[i]; j <= r[i]; j++) {
long long x = (j + (j/b)) % a;
long long y = j % b;
s.insert ({x, y});
}
}
printf("%d\n", (int)s.size());
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |