| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368248 | husseinjuanda | Strange Device (APIO19_strange_device) | C++20 | 156 ms | 32368 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, A, B; cin >> n >> A >> B;
vector<pair<int, int>> seg(n);
int sum = 0;
for(auto &i : seg){
cin >> i.first >> i.second;
sum += i.second - i.first + 1;
}
if(n == 1){
int l = seg[0].first;
int r = seg[0].second;
int j = lcm(A, B+1);
if(j < 0 || j%A != 0 || j%(B+1) != 0){
cout << r-l+1 << "\n";
return 0;
}
j = j/(B+1);
cout << min(j*B, r-l+1) << "\n";
return 0;
}
if(sum <= 1e6){
int t = 0;
map<pair<int, int>, bool> m;
for(auto y : seg){
for(int i = y.first; i <= y.second; i++){
m[{(i+i/B)%A, {i%B}}] = true;
}
}
cout << m.size() << "\n";
}
return 0;
}| # | 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... | ||||
