結果

問題 No.3241 Make Multiplication of 8
ユーザー karinohito
提出日時 2025-08-24 13:15:54
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 3,300 ms
コンパイル使用メモリ 278,852 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-24 13:16:00
合計ジャッジ時間 5,028 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll =long long;

#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin>>N;
    vector<ll> C(4,0);
    for(int i=0;i<N;i++){
        ll A,B;
        cin>>A>>B;
        int c=0;
        while(A%2==0){
            A/=2;
            c++;
        }
        c=min(c,3);
        C[c]+=B;
    }
    ll an=C[3];
    ll d=min(C[1],C[2]);
    an+=d;
    C[1]-=d;
    C[2]-=d;
    an+=(C[1]/3)+(C[2]/2);
    cout<<an<<"\n";
}
0