제출 #1255314

#제출 시각아이디문제언어결과실행 시간메모리
1255314M_SH_O이상한 기계 (APIO19_strange_device)C++20
0 / 100
193 ms2228 KiB
#include <bits/stdc++.h>
//#include "rainbow.h"

#define ll long long
#define ll1 long long
#define ull unsigned long long
#define dou long double
#define str string
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vbool vector<bool>
#define vstr vector<str>
#define vvll vector<vll>
#define pb push_back
#define pf push_front
#define endl "\n"
#define fr first
#define se second
// #define sortcmp(a) sort(a.begin(), a.end(), cmp)
#define sort(a) sort(a.begin(), a.end())
#define reverse(a) reverse(a.begin(), a.end())
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
//using namespace __gnu_pbds;

const ll INF = 1e18;
const int lg = 20;

mt19937 rng(time(0));
ll randll(ll l, ll r){
    return uniform_int_distribution<ll>(l, r)(rng);
}

int main(){
    speed;
    ll n, a, b;
    cin >> n >> a >> b;
    set<pll> s;
    ll x = max(b, a-a/b);
    
    for(int i = 0; i < n; i ++){
        ll l, r;
        cin >> l >> r;
        if(((r-l+1)/b+1) < b) cout << r-l+1 << endl;
        else cout << min(r-l+1, a*b) << 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...