結果

問題 No.723 2つの数の和
ユーザー tadanoningen
提出日時 2020-10-08 02:49:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 84,800 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-07-20 05:40:03
合計ジャッジ時間 2,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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++){
    if(x-a[i] >= 0 && x-a[i] < 100001)ans += c[x - a[i]];
  }
  cout << ans << endl;
  return 0;
}
0