結果

問題 No.723 2つの数の和
ユーザー xxxasdfghjk
提出日時 2018-08-12 13:22:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-09-24 07:06:39
合計ジャッジ時間 2,684 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  ll N,X,res=0;
  cin >> N >> X;
  vector<ll> a(N+1);
  map<ll,ll> mp;
  REP(i,N){
    cin >> a[i];
    mp[a[i]]++;
  }
  REP(i,N){
    res += mp[X-a[i]];
  }
  cout << res << endl;
  return 0;
}

0