結果
| 問題 |
No.3241 Make Multiplication of 8
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2025-08-22 21:04:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 4,043 ms |
| コンパイル使用メモリ | 251,364 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-22 21:04:27 |
| 合計ジャッジ時間 | 6,177 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000005
#define Inf64 1000000000000000001LL
int main(){
int n;
cin>>n;
long long c1 = 0,c2 = 0;
long long ans = 0;
rep(i,n){
long long a,b;
cin>>a>>b;
swap(a,b);
int c = 0;
while(b%2==0){
c++;
b /= 2;
}
if(c>=3)ans += a;
else{
if(c==1)c1 += a;
if(c==2)c2 += a;
}
}
if(c2 <= c1){
ans += c2;
ans += (c1-c2)/3;
}
else{
ans += c1;
ans += (c2-c1)/2;
}
cout<<ans<<endl;
}
沙耶花