結果

問題 No.3640 Babies don't like Bat Beat
コンテスト
ユーザー めーらく
提出日時 2026-08-25 15:43:17
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 776 ms / 2,000 ms
+ 826µs
コード長 2,724 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,639 ms
コンパイル使用メモリ 345,192 KB
実行使用メモリ 37,656 KB
最終ジャッジ日時 2026-08-25 15:43:33
合計ジャッジ時間 11,513 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
サンプル 0 %
小課題1 10 % AC * 5
小課題2 10 % AC * 10
小課題3 15 % AC * 5
小課題4 20 % AC * 10
小課題5 20 % AC * 15
小課題6 25 % AC * 33
合計 100 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <cassert>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll,ll>;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vs = vector<string>;
using vc = vector<char>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define uniq(v) sort(all(v)), (v).erase(unique(all(v)),(v).end())
#define lb(v,x) int(lower_bound(all(v),(x))-(v).begin())
#define ub(v,x) int(upper_bound(all(v),(x))-(v).begin())
#define rrep(i,n) for(int i = (int)(n) - 1; i>=0; i--)
#define rep1(i,n) for(int i=1; i <=(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n); i++)
#define koz " "
#define tor "\n"
template<class T> using min_pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool chmin(T& a, const T& b){if(b<a){a=b;return true;}return false;}
template<class T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T, typename U> T ceil(T x, U y){
    assert(y!=0);
    if(y<0) x=-x,y=-y;
    return (x>0 ? (x+y-1)/y : x/y);
}
template<typename T, typename U> T floor(T x, U y){
    assert(y!=0);
    if(y<0) x=-x,y=-y;
    return (x>0 ? x/y : (x-y+1)/y);
}
template<typename T> int popcnt(T x){return __builtin_popcountll(x);}

const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};

const int INF = 1045141919;
const ll LINF = 3643648101145141919;

void solve(){
    int n;
    cin >> n;
    vi comp;
    vpll data(n);
    int even=0,odd=0;
    rep(i,n){
        ll l,r;
        cin >>  l >> r;
        /*if(r==l) continue;
        if(r==2*l){
            even++,odd++;
            continue;
        }
        if(r-l==1){
        if(l%2==0) even++;
        else odd++;
        }
        else {
            even++;
            odd++;
        }*/
        comp.push_back(l);
        comp.push_back(r);
        data[i]={l,r};
        while(r<10000000000){
            l*=2;
            r*=2;
            comp.push_back(l);
            comp.push_back(r);
        }
       
    }
    uniq(comp);
    int sz=comp.size();
    vll imos(sz+1,0);
    for(auto[l,r]:data){
        while(r<10000000000){
        int ldx=lb(comp,l);
        int rdx=lb(comp,r);
        imos[ldx]++;
        imos[rdx]--;
        l*=2;
        r*=2;
        }
    }
    rep(i,sz) imos[i+1]+=imos[i];
    ll ans=0;
    rep(i,sz) chmax(ans,imos[i]);
    cout << ans << tor;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(16);

    int _ = 1;
    //cin >> _;
    while(_--) solve();
    
}
0