結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,360 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 55 ms
6,968 KB
testcase_04 AC 85 ms
8,048 KB
testcase_05 AC 73 ms
7,652 KB
testcase_06 AC 78 ms
7,856 KB
testcase_07 AC 27 ms
5,520 KB
testcase_08 AC 31 ms
5,768 KB
testcase_09 AC 78 ms
8,156 KB
testcase_10 AC 28 ms
5,420 KB
testcase_11 AC 7 ms
4,348 KB
testcase_12 AC 37 ms
6,112 KB
testcase_13 AC 83 ms
8,316 KB
testcase_14 AC 15 ms
4,768 KB
testcase_15 AC 26 ms
5,600 KB
testcase_16 AC 43 ms
6,580 KB
testcase_17 AC 64 ms
7,508 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using namespace std;

int main() {
    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) {
        if(v.count(x-k)) ans+=v.count(x-k);
    }
    cout << ans << "\n";
    return 0;
}
0