結果

問題 No.851 テストケース
コンテスト
ユーザー toyama
提出日時 2019-07-26 21:47:26
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 745 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 794 ms
コンパイル使用メモリ 91,816 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-23 11:34:30
合計ジャッジ時間 1,263 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 18 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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 1;
    }

    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;
}
0