結果
| 問題 |
No.851 テストケース
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-10 18:14:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 3,153 ms |
| コード長 | 908 bytes |
| コンパイル時間 | 1,198 ms |
| コンパイル使用メモリ | 82,916 KB |
| 最終ジャッジ日時 | 2025-01-09 15:43:35 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using lint = long long;
void solve() {
int n;
std::cin >> n;
{
std::string tmp;
std::getline(std::cin, tmp);
}
std::vector<lint> xs(n);
for (auto& x : xs) {
std::string s;
std::getline(std::cin, s);
if (std::count(s.begin(), s.end(), ' ')) {
std::cout << "\"assert\"" << std::endl;
return;
}
x = std::stoll(s);
}
std::vector<lint> ss;
for (int j = 0; j < n; ++j) {
for (int i = 0; i < j; ++i) {
ss.push_back(xs[i] + xs[j]);
}
}
std::sort(ss.rbegin(), ss.rend());
ss.erase(std::unique(ss.begin(), ss.end()), ss.end());
std::cout << ss[1] << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}