# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174544 | Muhammet | Strange Device (APIO19_strange_device) | C++17 | 5092 ms | 589824 KiB |
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define SZ(s) (int)s.size()
#define ff first
#define ss second
const int N = 3e5 + 5;
const int M = 1e9 + 7;
map <pair <ll, ll>, bool> mp;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
ll n, a, b;
cin >> n >> a >> b;
int ans = 0;
for(int i = 1; i <= n; i++) {
ll l, r;
cin >> l >> r;
for(ll j = l; j <= r; j++) {
if(mp.find({(j + (j / b)) % a, j % b}) == mp.end()) ans++;
mp[{(j + (j / b)) % a, j % b}] = true;
}
}
cout << ans;
# | 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... |