# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
206799 | rkm0959 | 이상한 기계 (APIO19_strange_device) | C++14 | 609 ms | 33920 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long int ll;
typedef long double ldb;
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll n, A, B, inf=2e18, ans;
pair<ll, ll> wow[2111111];
int main(void)
{
fio; ll i, j, u, v, cnt=0;
cin>>n>>A>>B; ll g=gcd(A, B+1);
__int128 cc=(A/g); cc=cc*B;
for(i=1 ; i<=n ; i++)
{
cin>>u>>v;
if(cc>=inf) { wow[++cnt]=make_pair(u, v); continue; }
u=(ll)(u%cc); v=(ll)(v%cc);
if(u<=v) wow[++cnt]=make_pair(u, v);
if(u>v)
{
wow[++cnt]=make_pair(u, (ll)cc-1LL);
wow[++cnt]=make_pair(0LL, v);
}
}
sort(wow+1, wow+cnt+1);
for(i=1 ; i<=cnt ; i++)
{
# | 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... |