結果

問題 No.723 2つの数の和
ユーザー Cyclone28Cyclone28
提出日時 2021-04-24 15:24:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 367 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 165,464 KB
実行使用メモリ 4,900 KB
最終ジャッジ日時 2023-09-17 13:37:27
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 22 ms
4,376 KB
testcase_04 AC 28 ms
4,592 KB
testcase_05 AC 26 ms
4,492 KB
testcase_06 AC 26 ms
4,588 KB
testcase_07 AC 13 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 13 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 17 ms
4,380 KB
testcase_13 AC 29 ms
4,628 KB
testcase_14 AC 8 ms
4,376 KB
testcase_15 AC 13 ms
4,376 KB
testcase_16 AC 19 ms
4,488 KB
testcase_17 AC 25 ms
4,424 KB
testcase_18 WA -
testcase_19 AC 32 ms
4,576 KB
testcase_20 WA -
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 28 ms
4,580 KB
testcase_24 AC 10 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int n, x; cin >> n >> x;
    vector<int> a(n), b(100001);
    for(int i = 0; i < n; i++) { cin >> a[i]; b[a[i]]++; }
    int ans = 0;
    for(int i = 1; i <= 100000; i++){
        if(x-i > 100000 || x-i < 0) continue;
        ans += b[i] * b[x-i];
    }
    cout << ans << endl;
}
0