Submission #934388

#TimeUsernameProblemLanguageResultExecution timeMemory
934388vjudge1Strange Device (APIO19_strange_device)C++17
10 / 100
5105 ms524288 KiB
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 1000000007
#define INF 1000000000
#define INF2 2000000000000000000
//#define ll long long
///#define cin fin
///#define cout fout
using namespace std;
double const EPS = 1e-14;
///ofstream fout("herding.out");
///ifstream fin("herding.in");

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    long long n, a, b; cin >> n >> a >> b;
    set<pair<long long, long long>> st;
    for(int i = 0; i < n; i++) {
        long long l, r; cin >> l >> r;
        for(long long j = l; j <= r; j++) {
            pair<long long, long long> p;
            p.first = (j + j/b)%a;
            p.second = (j%b);
            st.insert(p);
        }
    }
    cout << st.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...