結果

問題 No.723 2つの数の和
ユーザー ha71
提出日時 2020-09-22 16:05:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 489 bytes
コンパイル時間 1,516 ms
コンパイル使用メモリ 165,836 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 05:28:32
合計ジャッジ時間 4,782 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 4 RE * 12
権限があれば一括ダウンロードができます

ソースコード

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