結果
| 問題 | No.3241 Make Multiplication of 8 |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2025-08-22 21:15:59 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 2,000 ms |
| + 626µs | |
| コード長 | 416 bytes |
| 記録 | |
| コンパイル時間 | 2,058 ms |
| コンパイル使用メモリ | 332,100 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-14 07:06:19 |
| 合計ジャッジ時間 | 4,351 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
using ll=long long;
int n;
cin>>n;
vector<ll> cnt(4);
for (int i=0;i<n;i++){
int a,b;
cin>>a>>b;
int k=0;
while (a%2==0){
a/=2;
k++;
}
cnt[min(k,3)]+=b;
}
ll c1=cnt[1],c2=cnt[2],c3=cnt[3];
ll ans=c3;
ll x=min(c1,c2);
c1-=x;c2-=x;
ans+=x;
if (c1) ans+=c1/3;
if (c2) ans+=c2/2;
cout<<ans<<endl;
}
tau1235