結果
問題 | No.1122 Plane Tickets |
ユーザー |
![]() |
提出日時 | 2020-07-22 23:34:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,058 bytes |
コンパイル時間 | 1,586 ms |
コンパイル使用メモリ | 170,792 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 01:32:47 |
合計ジャッジ時間 | 3,027 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 42 WA * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' #define vec vector<ll> #define mat vector<vector<ll> > #define fi first #define se second typedef long long ll; typedef pair<ll,ll> pll; typedef long double ld; const ll inf=1e9+7; const ll mod=998244353; signed main(){ vector<ll>a(10); rep(i,5)cin>>a[i]; REP(i,5,10){ a[i]=a[i-5]; } a.pb(a[0]); ll ans=0; rep(i,5){ vector<ll>b(11); ll cnt=0; rep(i,11){ b[i]=a[i]; } REP(j,i,i+5){ ll mi=b[j]; mi=min(mi,b[j+1]); mi=min(mi,b[j+2]); cnt+=mi; if(j+5<11)b[j+5]-=mi; b[j+1]-=mi; b[j+2]-=mi; if(j==i){ b[j+6]-=mi; } } ans=max(ans,cnt); } cout<<ans<<endl; }