結果

問題 No.2691 Longest Infection Sequence
ユーザー otoshigo
提出日時 2024-03-22 21:25:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 190,556 KB
最終ジャッジ日時 2025-02-20 11:06:23
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans=0;
    if(a>0)chmax(ans,a+c+d);
    if(b>0)chmax(ans,b+c+d);
    if(d>0)chmax(ans,c+d);
    cout<<ans<<"\n";
}
0