結果

問題 No.851 テストケース
ユーザー 0w1
提出日時 2019-07-31 20:24:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 3,153 ms
コード長 801 bytes
コンパイル時間 2,369 ms
コンパイル使用メモリ 202,836 KB
最終ジャッジ日時 2025-01-07 10:20:34
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  auto get_ints = []() {
    vector<int64_t> res;
    string buf;
    getline(cin, buf);
    stringstream ss(buf);
    for (string s; ss >> s; ) {
      res.push_back(stoll(s));
    }
    return res;
  };

  int N = get_ints()[0];
  assert(N == 3);

  vector<int64_t> r1 = get_ints();
  if (r1.size() == 3) {
    cout << "\"assert\"" << endl;
  } else {
    r1.push_back(get_ints()[0]);
    r1.push_back(get_ints()[0]);
    vector<int64_t> sums;
    for (int i = 0; i < N; ++i) {
      for (int j = i + 1; j < N; ++j) {
        sums.push_back(r1[i] + r1[j]);
      }
    }
    sort(sums.begin(), sums.end(), [](int64_t x, int64_t y) { return x > y; });
    unique(sums.begin(), sums.end());
    cout << sums[1] << endl;
  }
  
  return 0;
}
0