結果

問題 No.723 2つの数の和
ユーザー firiexpfiriexp
提出日時 2018-08-03 22:51:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 390 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 73,024 KB
実行使用メモリ 12,464 KB
最終ジャッジ日時 2023-10-19 21:33:45
合計ジャッジ時間 4,951 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
11,360 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 40 ms
6,924 KB
testcase_04 AC 63 ms
8,004 KB
testcase_05 AC 47 ms
7,608 KB
testcase_06 AC 54 ms
7,812 KB
testcase_07 AC 19 ms
5,476 KB
testcase_08 AC 21 ms
5,724 KB
testcase_09 AC 55 ms
8,112 KB
testcase_10 AC 19 ms
5,376 KB
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 25 ms
6,068 KB
testcase_13 AC 60 ms
8,272 KB
testcase_14 AC 10 ms
4,724 KB
testcase_15 AC 18 ms
5,556 KB
testcase_16 AC 30 ms
6,536 KB
testcase_17 AC 42 ms
7,464 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>

using ll = long long;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n, x, a, ans = 0;
    cin >> n >> x;
    multiset<int> v;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        v.insert(a);
    }
    for (auto &k : v) {
        ans+=v.count(x-k);
    }
    cout << ans << "\n";
    return 0;
}
0