結果
| 問題 |
No.851 テストケース
|
| コンテスト | |
| ユーザー |
toyama
|
| 提出日時 | 2019-07-26 21:47:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 3,153 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 802 ms |
| コンパイル使用メモリ | 77,672 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-02 06:56:28 |
| 合計ジャッジ時間 | 1,661 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
using ll = long long;
int main()
{
ll n;
ll a[3];
ll line = 0;
scanf("%lld", &n);
for (int i = 0; i < n; i++) {
scanf("%lld", a + i);
char ch = getchar();
if (ch == '\n') {
line++;
}
}
if (line != 3) {
puts("\"assert\"");
return 0;
}
vector<ll> x;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
x.push_back(a[i] + a[j]);
}
}
sort(x.begin(), x.end());
x.erase(unique(x.begin(), x.end()), x.end());
cout << x[x.size() - 2] << endl;
return 0;
}
toyama