結果
問題 |
No.505 カードの数式2
|
ユーザー |
|
提出日時 | 2018-09-18 09:21:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 437 bytes |
コンパイル時間 | 531 ms |
コンパイル使用メモリ | 66,176 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 07:54:25 |
合計ジャッジ時間 | 1,504 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 17 |
ソースコード
#include<iostream> #include<vector> using namespace std; typedef long long ll; int main(){ int n, x; cin >> n; ll a = 0, b = 0; for(int i = 0; i < n; i++){ cin >> x; ll na = max(max(a, max(a*x, max(a+x, a-x))), max(b, max(b*x, max(b+x, b-x)))); ll nb = min(min(a, min(a*x, min(a+x, a-x))), min(b, min(b*x, min(b+x, b-x)))); a = na, b = nb; } cout << a << endl; return 0; }