結果
| 問題 | No.851 テストケース |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-31 20:23:35 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 780 bytes |
| 記録 | |
| コンパイル時間 | 1,813 ms |
| コンパイル使用メモリ | 218,596 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 15:47:13 |
| 合計ジャッジ時間 | 4,154 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 2 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:32:11: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
32 | unique(sums.begin(), sums.end());
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:63,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algo.h:875:5: note: declared here
875 | unique(_ForwardIterator __first, _ForwardIterator __last)
| ^~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
auto get_ints = []() {
vector<int> res;
string buf;
getline(cin, buf);
stringstream ss(buf);
for (string s; ss >> s; ) {
res.push_back(stoi(s));
}
return res;
};
int N = get_ints()[0];
assert(N == 3);
vector<int> r1 = get_ints();
if (r1.size() == 3) {
cout << "\"assert\"" << endl;
} else {
r1.push_back(get_ints()[0]);
r1.push_back(get_ints()[0]);
vector<int> 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(), [](int x, int y) { return x > y; });
unique(sums.begin(), sums.end());
cout << sums[1] << endl;
}
return 0;
}