結果

問題 No.723 2つの数の和
ユーザー ha71ha71
提出日時 2020-09-22 16:05:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 489 bytes
コンパイル時間 1,702 ms
コンパイル使用メモリ 164,336 KB
実行使用メモリ 5,048 KB
最終ジャッジ日時 2023-09-08 12:15:43
合計ジャッジ時間 5,225 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,492 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 16 ms
4,984 KB
testcase_19 AC 32 ms
4,964 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 29 ms
4,864 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include "atcoder/all"
typedef long long int ll;
using namespace std;
// using namespace atcoder;
#define MAXN 100001
ll a[MAXN];
ll cnt[MAXN];
int main() {
    ll n, x;
    cin >> n >> x;
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; i++) {
        ll ax;
        cin >> ax;
        a[i] = ax;
        cnt[ax]++;
    }
    ll ret = 0;
    for (int i = 1; i <= n; i++) {
        ret += cnt[x - a[i]];
    }
    cout << ret << endl;
    return 0;
}
0