結果

問題 No.723 2つの数の和
ユーザー beet
提出日時 2018-08-03 22:21:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 1,542 ms
コンパイル使用メモリ 177,280 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-09-19 17:27:51
合計ジャッジ時間 3,844 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,x;
  cin>>n>>x;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  map<Int, Int> cnt;
  Int ans=0;
  for(Int i=0;i<n;i++){
    cnt[a[i]]++;
  } 
  for(Int i=0;i<n;i++){
    ans+=cnt[x-a[i]];
  }
  cout<<ans<<endl;
  return 0;
}
0