結果

問題 No.851 テストケース
ユーザー toyamatoyama
提出日時 2019-07-26 21:36:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 63,956 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-09-15 00:46:35
合計ジャッジ時間 1,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,388 KB
testcase_03 AC 1 ms
4,512 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
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 <= 1) {
        puts("\"assert\"");
        return 0;
    }

    ll max1 = 0, max2 = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;

            if (max1 < a[i] + a[j]) {
                max2 = max1;
                max1 = a[i] + a[j];
            }
        }
    }

    cout << max2 << endl;

    return 0;
}
0