結果
| 問題 | No.3534 Make Many Fences |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2026-05-09 02:28:29 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 223 ms / 1,000 ms |
| コード長 | 391 bytes |
| 記録 | |
| コンパイル時間 | 3,332 ms |
| コンパイル使用メモリ | 330,824 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-09 02:28:39 |
| 合計ジャッジ時間 | 5,326 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
void solve(){
using ll=long long;
ll n,m;
cin>>n>>m;
ll ans=0;
auto f=[&](ll k){
if (k<0) return;
ll n2=n-2*k,m2=m+4*k;
if (!(n2>=0&&m2>=0)) return;
ll p=min(n2/4,m2/2);
ans=max(ans,p*3);
};
f(0);f(n/2);f((n-2*m)/10);f((n-2*m+9)/10);
cout<<ans<<endl;
}
int main(){
int t;
cin>>t;
while (t--) solve();
}
tau1235