# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
741573 | yeyso | Strange Device (APIO19_strange_device) | C++14 | 5054 ms | 524288 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;
int main(){
long long n, a, b; cin >> n >> a >> b;
vector<pair<long long, long long>> periods;
long long l, r;
long long time = 0;
for(long long i = 0; i < n; i ++){
cin >> l >> r;
periods.push_back({l, r});
}
time = periods[periods.size()-1].second;
set<pair<long long, long long>> res;
long long x, y;
for(long long i = 0; i < n; i ++){
for(long long t = periods[i].first; t <= periods[i].second; t ++){
x = (t + (t/b)) % a;
y = t % b;
res.insert({x, y});
}
}
cout << res.size();
}
/*
g++ -std=gnu++17 -O2 -pipe -static -o device device.cpp
3 3 3
4 4
7 9
17 18
*/
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... |