結果

問題 No.723 2つの数の和
ユーザー Y17Y17
提出日時 2018-10-06 12:30:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 1,240 ms
コンパイル使用メモリ 166,520 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-04-20 17:49:37
合計ジャッジ時間 2,964 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 55 ms
7,936 KB
testcase_04 AC 76 ms
8,320 KB
testcase_05 AC 69 ms
8,576 KB
testcase_06 AC 70 ms
8,448 KB
testcase_07 AC 32 ms
6,656 KB
testcase_08 AC 35 ms
6,912 KB
testcase_09 AC 76 ms
9,088 KB
testcase_10 AC 30 ms
6,272 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 44 ms
7,424 KB
testcase_13 AC 80 ms
9,728 KB
testcase_14 AC 18 ms
5,632 KB
testcase_15 AC 32 ms
7,040 KB
testcase_16 AC 49 ms
8,192 KB
testcase_17 AC 67 ms
8,960 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 57 ms
8,448 KB
testcase_24 AC 22 ms
6,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n, x;
  int a[100010];
  map<int, int> mp;
  cin >> n >> x;

  for(int i = 0;i < n;i++){
    cin >> a[i];
    mp[a[i]]++;
  }

  int ans = 0;
  for(int i = 0;i < n;i++){
    ans += mp[x-a[i]];
  }

  cout << ans << endl;
  return 0;
}
0