結果
| 問題 | No.851 テストケース |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-26 21:48:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 3,153 ms |
| コード長 | 715 bytes |
| コンパイル時間 | 1,603 ms |
| コンパイル使用メモリ | 175,940 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-02 06:58:04 |
| 合計ジャッジ時間 | 2,437 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n);
string s;
getline(cin, s);
getline(cin, s);
bool ok = true;
for (char c : s) if (c == ' ') ok = false;
if (!ok) {
cout << "\"assert\"" << endl;
return 0;
} else {
a[0] = stoll(s);
}
for (int i = 1; i < n; i++) cin >> a[i];
set<ll> sum;
for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) sum.insert(a[i] + a[j]);
auto it = sum.rbegin();
it++;
cout << *it << endl;
return 0;
}