| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367137 | Nxmkxing | Strange Device (APIO19_strange_device) | C++20 | 159 ms | 15960 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
const int N = 1e6 + 10;
ll n, a, b, l[N], r[N];
vector<ll> vec[N];
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
cin >> n >> a >> b;
set<pll> st;
for (int i = 1; i <= n; i++) {
cin >> l[i] >> r[i];
}
ll sz = r[1] - l[1] + 1;
ll blocks = sz / b;
ll left = sz % b;
ll mx = a / gcd(b + 1, a);
if (blocks < mx) {
cout << blocks * b + left;
}
else if (blocks == mx) {
cout << blocks * b;
}
else {
cout << mx * b;
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
