# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549895 | Hanksburger | Strange Device (APIO19_strange_device) | C++17 | 510 ms | 49908 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;
vector<pair<long long, long long> > vec;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, a, b, num, curl, curr, ans=0;
cin >> n >> a >> b;
num=a*b/gcd(a*b, b+1);
for (long long i=1; i<=n; i++)
{
long long l, r;
cin >> l >> r;
if (l+num<=r)
vec.push_back({0, num-1});
else if (l%num<=r%num)
vec.push_back({l%num, r%num});
else
{
vec.push_back({l%num, num-1});
vec.push_back({0, r%num});
}
}
sort(vec.begin(), vec.end());
curl=vec[0].first;
curr=vec[0].second;
for (long long i=1; i<vec.size(); i++)
{
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... |