結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
nxteru
|
| 提出日時 | 2018-08-28 21:42:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 658 bytes |
| コンパイル時間 | 615 ms |
| コンパイル使用メモリ | 82,240 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 06:36:07 |
| 合計ジャッジ時間 | 2,793 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 11 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
ll n,ma,mi;
int main(void){
cin>>n>>ma;
mi=ma;
for(int i=1;i<n;i++){
ll a;
cin>>a;
ll x=ma,y=mi;
ma=max(max(max(x+a,x-a),max(x*a,x/a)),max(max(y+a,y-a),max(y*a,y/a)));
mi=min(min(min(x+a,x-a),min(x*a,x/a)),min(min(y+a,y-a),min(y*a,y/a)));
}
cout<<ma<<endl;
}
nxteru