| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 673820 | QwertyPi | 이상한 기계 (APIO19_strange_device) | C++14 | 1671 ms | 100376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
using namespace std;
ostream& operator<<(ostream& out, __int128_t x){
string s; while(x) s.push_back(x % 10 + '0'), x /= 10;
reverse(s.begin(), s.end()); return out << s;
}
int32_t main(){
int n, a, b; cin >> n >> a >> b;
__int128_t c = (__int128_t) b * (a / __gcd(a, b + 1));
vector<pair<__int128_t, __int128_t>> d;
for(int i = 0; i < n; i++){
int l, r; cin >> l >> r;
if(r - l + 1 >= c){
cout << c << endl;
return 0;
}
if(l / c == r / c){
d.push_back({l % c, 1});
d.push_back({r % c + 1, -1});
}else{
d.push_back({l % c, 1});
d.push_back({0, 1});
d.push_back({r % c + 1, -1});
}
}
d.push_back({c, 0});
sort(d.begin(), d.end());
int cnt = 0, ans = 0;
for(int i = 0; i < d.size() - 1; i++){
cnt += d[i].second;
if(cnt > 0){
ans += d[i + 1].first - d[i].first;
}
}
cout << ans << endl;
}컴파일 시 표준 에러 (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... | ||||
