답안 #721646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721646 2023-04-11T06:07:50 Z victor_gao 이상한 기계 (APIO19_strange_device) C++17
5 / 100
359 ms 12016 KB
//#pragma GCC optimize("Ofast,unroll-loops,O3")
//#pragma GCC optimize("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//#pragma pack(1)
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define int long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
//using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//typedef tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> order_multiset;
//typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> order_set;
int findt(int a,int b){
    int go=b+1,g=__gcd(go,a);
   // cout<<go<<" "<<a<<' '<<b<<" "<<g<<'\n';
    // lcm(go,a)/go*b
    return a/g*b;
}
int vis[1500000];
signed main(){
    fast
    int n,a,b; cin>>n>>a>>b;
    int t=findt(a,b);
    for (int i=1;i<=n;i++){
        int l,r; cin>>l>>r;
        l%=t; r%=t;
        if (l<=r){
            vis[l]++; vis[r+1]--;
        }
        else {
            vis[0]++; vis[r+1]--;
            vis[l]++; vis[t]--;
        }
    }
    int ans=0;
    for (int i=0;i<1500000;i++){
        if (i) vis[i]+=vis[i-1];
        ans+=(vis[i]>0);
    }
    cout<<ans<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 11988 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 11960 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 11984 KB Output is correct
2 Correct 12 ms 11988 KB Output is correct
3 Correct 12 ms 12004 KB Output is correct
4 Correct 11 ms 11988 KB Output is correct
5 Correct 254 ms 11968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12016 KB Output is correct
2 Correct 359 ms 12000 KB Output is correct
3 Runtime error 1 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12016 KB Output is correct
2 Correct 359 ms 12000 KB Output is correct
3 Runtime error 1 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12016 KB Output is correct
2 Correct 359 ms 12000 KB Output is correct
3 Runtime error 1 ms 468 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 11988 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 11988 KB Output is correct
2 Runtime error 2 ms 468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -