結果

問題 No.723 2つの数の和
ユーザー tadanoningen
提出日時 2020-10-08 02:43:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 84,696 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-07-20 05:39:56
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> a(n);
  map<int,int> c;
  
  for(int i=0;i < n;i++){
    cin >> a[i];
    c[a[i]]++;
  }

  int ans = 0;

  for(int i=0;i < n;i++){
    ans += c[x - a[i]];
  }
  cout << ans << endl;
  return 0;
}
0