Submission #48753583


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    ll a,m,l,r;
    cin>>a>>m>>l>>r;
    l -= a;
    r -= a;
    ll c = 1ll<<61;
    c = (c+m)/m*m;
    l += c;
    r += c;
    ll ans = r/m - (l-1)/m;
    cout<<ans<<endl;
    return 0;
}

Submission Info

Submission Time
Task B - Christmas Trees
User rickytheta
Language C++ 20 (gcc 12.2)
Score 250
Code Size 916 Byte
Status AC
Exec Time 1 ms
Memory 3656 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 20
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 03_minmax_00.txt, 03_minmax_01.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3436 KiB
00_sample_01.txt AC 1 ms 3496 KiB
00_sample_02.txt AC 1 ms 3564 KiB
01_random_00.txt AC 1 ms 3436 KiB
01_random_01.txt AC 1 ms 3460 KiB
01_random_02.txt AC 1 ms 3436 KiB
02_random2_00.txt AC 1 ms 3556 KiB
02_random2_01.txt AC 1 ms 3452 KiB
02_random2_02.txt AC 1 ms 3460 KiB
02_random2_03.txt AC 1 ms 3488 KiB
02_random2_04.txt AC 1 ms 3468 KiB
02_random2_05.txt AC 1 ms 3488 KiB
02_random2_06.txt AC 1 ms 3564 KiB
02_random2_07.txt AC 1 ms 3440 KiB
02_random2_08.txt AC 1 ms 3652 KiB
03_minmax_00.txt AC 1 ms 3492 KiB
03_minmax_01.txt AC 1 ms 3556 KiB
04_handmade_00.txt AC 1 ms 3460 KiB
04_handmade_01.txt AC 1 ms 3496 KiB
04_handmade_02.txt AC 1 ms 3656 KiB