結果
問題 | No.2691 Longest Infection Sequence |
ユーザー |
![]() |
提出日時 | 2024-03-22 21:27:22 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,040 bytes |
コンパイル時間 | 6,697 ms |
コンパイル使用メモリ | 163,904 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-30 13:22:55 |
合計ジャッジ時間 | 4,025 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h>#define int llusing namespace std;#define rep(i,n) for(int i=0;i<n;i++)#define per(i,n) for(int i=n-1;i>=0;i--)#define rng(i,c,n) for(int i=c;i<n;i++)#define fi first#define se second#define pb push_back#define all(a) a.begin(), a.end()#define sz(a) ((int) a.size())#define vec(...) vector<__VA_ARGS__>#define _4ab8goq ios::sync_with_stdio(0),cin.tie(0);typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pii;void print(){cout<<'\n';}template<class h,class...t>void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}void slv(){const int n=4;vi ord(n);iota(all(ord),0);vec(vi) adj={{0,3},{1,3},{0,1,2,3},{3}};vi cnt(n);rep(i,n){cin>>cnt[i];}int ans=0;do{int now=0;rep(i,n){now+=cnt[ord[i]];ans=max(ans,now);if(i+1<n){int ho=0;for(auto v:adj[ord[i+1]]){if(v==ord[i]){ho=1;}}if(!ho) break;}}}while(next_permutation(all(ord)));print(ans);}signed main(){_4ab8goq;slv();}