結果
| 問題 | No.3534 Make Many Fences |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-08 23:05:13 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 1,000 ms |
| コード長 | 686 bytes |
| 記録 | |
| コンパイル時間 | 1,587 ms |
| コンパイル使用メモリ | 210,604 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-08 23:05:18 |
| 合計ジャッジ時間 | 4,467 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:57:33: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
57 | c=min((N-a)/4,(M+2*a)/2);
| ~~^~~
main.cpp:52:28: note: 'a' was declared here
52 | ll a,b=x;
| ^
main.cpp:45:33: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
45 | c=min((N-a)/4,(M+2*a)/2);
| ~~^~~
main.cpp:40:28: note: 'a' was declared here
40 | ll a,b=x-1;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
const ll MOD=998244353;
int main(void){
cin.tie(nullptr); ios_base::sync_with_stdio(false);
ll i,j;
int T;
cin >> T;
while(T--){
ll N,M;
cin >> N >> M;
ll x=max(0LL,(N-2*M)/5);
ll c,d;
if(x%2==1){
ll a,b=x-1;
if(N>=x+1){
a=x+1;
}
c=min((N-a)/4,(M+2*a)/2);
d=min((N-b)/4,(M+2*b)/2);
cout << 3*max(c,d) << endl;
}else{
ll a,b=x;
if(N>=x+2){
a=x+2;
}
c=min((N-a)/4,(M+2*a)/2);
d=min((N-b)/4,(M+2*b)/2);
cout << 3*max(c,d) << endl;
}
}
return 0;
}