結果
| 問題 |
No.3241 Make Multiplication of 8
|
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2025-08-22 21:15:59 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 2,705 ms |
| コンパイル使用メモリ | 278,256 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-22 21:16:05 |
| 合計ジャッジ時間 | 5,447 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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