結果

問題 No.723 2つの数の和
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-20 23:45:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 201,560 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-04-16 04:28:49
合計ジャッジ時間 4,144 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 70 ms
7,808 KB
testcase_04 AC 91 ms
8,064 KB
testcase_05 AC 84 ms
8,448 KB
testcase_06 AC 87 ms
8,064 KB
testcase_07 AC 38 ms
6,940 KB
testcase_08 AC 42 ms
6,940 KB
testcase_09 AC 102 ms
8,960 KB
testcase_10 AC 34 ms
6,944 KB
testcase_11 AC 8 ms
6,944 KB
testcase_12 AC 51 ms
7,040 KB
testcase_13 AC 107 ms
9,472 KB
testcase_14 AC 21 ms
6,940 KB
testcase_15 AC 40 ms
6,944 KB
testcase_16 AC 63 ms
7,936 KB
testcase_17 AC 85 ms
8,704 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 67 ms
8,320 KB
testcase_24 AC 27 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n,x;cin>>n>>x;
    map<int,int> mp;
    int ans=0;
    for (int i=0;i<n;i++) {
        int a;cin>>a;
        mp[a]++;
        ans+=2*mp[x-a];
        if (a==x-a) ans--;
    }
    cout<<ans<<endl;
    return 0;
}
0