제출 #782428

#제출 시각아이디문제언어결과실행 시간메모리
782428christinelynnStrange Device (APIO19_strange_device)C++17
10 / 100
5050 ms524288 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long ll;
const ll INF = 1e9; //4e18;
const ll MOD = 1e9 + 7;
const ll MAXN = 2e5 + 5;
const ll LOG = 30; //20;
const double EPS = 1e-9;
#define vi vector <int>
#define vll vector <ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define ipi pair <int, pii>
#define lpl pair <ll, pll>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'
#define apaaja                          ios_base::sync_with_stdio(0);       cin.tie(0);                         cout.tie(0);                    
ll n, a, b;
set < pll > s;

int main(){
    apaaja
    cin >> n >> a >> b;
    for(ll i = 0; i < n; i++){
        ll l, r; cin >> l >> r;
        while(l <= r){
            s.insert(mp((l + (l/b)) % a, l % b));
            l++;
        }
    }
    cout << s.size() << endl;
}
#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...