# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174717 | Halym2007 | Strange Device (APIO19_strange_device) | C++17 | 285 ms | 18800 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz size()
#define ff first
#define ss second
#define pb push_back
#define pii pair <ll, ll>
#define dur exit(0)
#define dur1 return(0)
const int N = 2e5 + 5;
ll n, A, B;
int main () {
// freopen ("input.txt", "r", stdin);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> A >> B;
__int128 rep = (__int128)A / (__int128)__gcd (A, B + 1) * (__int128)B;
vector <pii> v;
for (int i = 1; i <= n; ++i) {
ll l, r;
cin >> l >> r;
if (r - l + 1 >= rep) {
v.pb ({0, rep - 1});
}
else if (l % rep <= r % rep) {
v.pb ({l % rep, r % rep});
}
else {
v.pb ({l % rep, rep - 1});
# | 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... |