# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
563610 | Ooops_sorry | Strange Device (APIO19_strange_device) | C++14 | 5083 ms | 117464 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;
#define pb push_back
#define ld long double
#define ll long long
mt19937 rnd(51);
ll solve(ll n, ll a, ll b, vector<ll> l, vector<ll> r) {
ll ans = 0, need;
bool was = 0, sum = 0;
if (log2(a) + log2(b) > log2(1e18) + 1) {
sum = 1;
} else {
for (ll k = 1;; k++) {
if ((k * b + k) % a == 0) {
need = k * b;
break;
}
}
}
vector<pair<ll, ll>> seg, u;
for (int i = 0; i < n; i++) {
if (sum) {
ans += r[i] - l[i] + 1;
} else {
if (r[i] - l[i] + 1 >= need) {
was = 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... |