結果

問題 No.723 2つの数の和
ユーザー とばりとばり
提出日時 2018-08-03 22:43:45
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 73,352 KB
実行使用メモリ 11,508 KB
最終ジャッジ日時 2023-10-19 21:31:14
合計ジャッジ時間 2,958 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 78 ms
9,208 KB
testcase_04 AC 109 ms
9,836 KB
testcase_05 AC 94 ms
10,196 KB
testcase_06 AC 101 ms
9,824 KB
testcase_07 AC 41 ms
7,500 KB
testcase_08 AC 47 ms
7,768 KB
testcase_09 AC 112 ms
10,760 KB
testcase_10 AC 38 ms
7,028 KB
testcase_11 AC 8 ms
4,648 KB
testcase_12 AC 54 ms
8,396 KB
testcase_13 AC 113 ms
11,508 KB
testcase_14 AC 24 ms
6,344 KB
testcase_15 AC 41 ms
7,876 KB
testcase_16 AC 63 ms
9,424 KB
testcase_17 AC 89 ms
10,640 KB
testcase_18 AC 18 ms
4,348 KB
testcase_19 AC 32 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 72 ms
9,916 KB
testcase_24 AC 27 ms
6,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <vector>
using namespace std;

using int64 = long long;

map<int, int64> counter;

int main() {
    int N, X;
    cin >> N >> X;

    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        counter[a[i]]++;
    }

    int64 ans = 0;
    for (int i = 0; i < N; i++) {
        ans += counter[X - a[i]];
    }
    cout << ans << endl;
    
    return 0;
}
0