結果
問題 |
No.3241 Make Multiplication of 8
|
ユーザー |
|
提出日時 | 2025-08-22 21:06:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 2,846 ms |
コンパイル使用メモリ | 278,344 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-22 21:06:33 |
合計ジャッジ時間 | 5,296 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int n; cin>>n; vector<ll> a(3); for(int i=0;i<n;i++){ ll s,t; cin>>s>>t; if(s%8==0)a[2]+=t; else if(s%4==0)a[1]+=t; else if(s%2==0)a[0]+=t; } ll ans=a[2]; if(a[1]>=a[0]){ ans+=a[0]; a[1]-=a[0]; ans+=a[1]/2; }else{ ans+=a[1]; a[0]-=a[1]; ans+=a[0]/3; } cout<<ans<<endl; }