結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-18 09:19:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 405 bytes |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 66,868 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 07:54:23 |
| 合計ジャッジ時間 | 1,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 20 |
ソースコード
#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;
a = max(max(a, max(a*x, max(a+x, a-x))), max(b, max(b*x, max(b+x, b-x))));
b = min(min(a, min(a*x, min(a+x, a-x))), min(b, min(b*x, min(b+x, b-x))));
}
cout << a << endl;
return 0;
}