結果
| 問題 |
No.505 カードの数式2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-29 12:55:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 976 bytes |
| コンパイル時間 | 960 ms |
| コンパイル使用メモリ | 105,716 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 19:13:27 |
| 合計ジャッジ時間 | 3,377 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 11 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> a(n);
for(int i=0; i<n; ++i)
cin >> a[i];
long long x = a[0];
long long y = a[0];
for(int i=1; i<n; ++i){
vector<long long> v = {
x + a[i], x - a[i], x * a[i], x / a[i],
y + a[i], y - a[i], y * a[i], y / a[i],
};
x = LLONG_MAX;
y = LLONG_MIN;
for(int j=0; j<8; ++j){
x = min(x, v[j]);
y = max(y, v[j]);
}
}
cout << y << endl;
return 0;
}