結果

問題 No.723 2つの数の和
ユーザー Y17
提出日時 2018-10-06 12:32:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 1,381 ms
コンパイル使用メモリ 166,360 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-10-12 13:46:10
合計ジャッジ時間 3,259 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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]]++;
  }

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

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