結果

問題 No.723 2つの数の和
ユーザー nxteru
提出日時 2018-08-03 22:40:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 17:31:54
合計ジャッジ時間 1,989 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
ll n,x,a[100005],ans;
int main(void){
    cin>>n>>x;
    for(int i=0;i<n;i++){
        ll y;
        cin>>y;
        a[y]++;
    }
    for(int i=0;i<=100000;i++){
        if(0<=x-i&&x-i<=100000){
            ans+=a[i]*a[x-i];
        }
    }
    cout<<ans<<endl;
}
0