結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-08-14 18:31:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 173,876 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 08:53:19 |
合計ジャッジ時間 | 3,325 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, x; cin >> n >> x; vector<int64_t> as(n); for (auto &a : as) { cin >> a; } sort(as.begin(), as.end()); int64_t ans = 0; for (int i = 0; i < n; i++) { ans += distance(lower_bound(as.begin() + i + 1, as.end(), n - as[i]), upper_bound(as.begin(), as.end(), n - as[i])); } cout << ans << endl; return 0; }