# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
510629 | amukkalir | Strange Device (APIO19_strange_device) | C++17 | 5085 ms | 524292 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>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n, a, b;
signed main () {
scanf("%d %d %d", &n, &a, &b);
set<pii> s;
for(int i=0; i<n; i++) {
ll l, r; scanf("%lld %lld", &l, &r);
for(ll j = l; j <= r; j++) {
ll x = (j + j/b) % a;
ll y = j % b;
//cerr << x << " " << y << endl;
s.insert(mp(x, y));
}
}
ll ans = s.size();
printf("%lld", ans);
}
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... |