| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 409666 | glebustim | 이상한 기계 (APIO19_strange_device) | C++17 | 930 ms | 98048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
typedef __int128 lll;
using namespace std;
lll gcd(lll x, lll y) {
while (y > 0) {
lll z = x % y;
x = y;
y = z;
}
return x;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
ll _a, _b;
cin >> n >> _a >> _b;
lll a = _a, b = _b, len = a * b / gcd(a, b + 1);
map<lll, int> s;
for (int i = 0; i < n; ++i) {
ll l, r;
cin >> l >> r;
lll f = l % len;
if (f + r - l >= len) {
++s[0];
--s[r % len + 1];
++s[f];
--s[len];
}
else {
++s[f];
--s[f + r - l + 1];
}
}
int bal = 0;
ll ans = 0;
lll prev = -1;
for (auto [t, e]: s) {
if (bal > 0)
ans += t - prev;
bal += e;
prev = t;
}
cout << ans << endl;
}
| # | 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... | ||||
