제출 #974621

#제출 시각아이디문제언어결과실행 시간메모리
974621AbitoStrange Device (APIO19_strange_device)C++17
10 / 100
5019 ms524288 KiB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=1e6+5;
int n,a,b,l[N],r[N];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>a>>b;
    for (int i=1;i<=n;i++) cin>>l[i]>>r[i];
    set<pair<int,int>> s;
    for (int i=1;i<=n;i++){
        for (int j=l[i];j<=r[i];j++){
            int x=(j+j/b)%a,y=j%b;
            s.ep({x,y});
        }
    }
    cout<<s.size()<<endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...