結果
問題 |
No.505 カードの数式2
|
ユーザー |
![]() |
提出日時 | 2025-06-20 22:55:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,333 bytes |
コンパイル時間 | 2,846 ms |
コンパイル使用メモリ | 275,612 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-20 22:55:46 |
合計ジャッジ時間 | 5,240 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 4 RE * 11 |
ソースコード
/* ?????? ?????? ?????? ?????? D P ???? ?????? ?????? ?????? ?????? ??? l l? ?????? ?????? ?? OI ?? ?????? */ #include<bits/stdc++.h> using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();} while (ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-48;ch=getchar();} return x*f; } void write(int x) { if(x<0)putchar('-'),x=-x; if(x<10)putchar(x+'0'); else write(x/10),putchar(x%10+'0'); } const int N=1e1; const int mod=1e9+7; //const int mod=998244353; void T_(){ int sum=0; while(sum<=3e9)sum++; } void point(){ } void clear(){ } int a[100]; void solve(){ int n=read(); for(int i=1;i<=n;i++)a[i]=read(); int minn=a[1]; int maxn=a[1]; for(int i=2;i<=n;i++){ maxn=max(maxn/a[i],max(maxn*a[i],max(minn*a[i],max(maxn+a[i],maxn-a[i])))); minn=min(maxn*a[i],min(minn*a[i],min(minn+a[i],minn-a[i]))); } cout<<maxn<<"\n"; } signed main(){ int T=1; // cin>>T; while(T--)solve(); return 0; } // ?????????????AC???? // ????????????????????????? // ?????????????????? // ???????????????????????????????????? // ??????????????????????????????? // ???????????? // ???????????? // ???????????? // ???????????????????? // ???????????????????? // ???????????????????????????????? // ??????????????????????? // ??????????? // ?????????????