結果

問題 No.723 2つの数の和
ユーザー Naco
提出日時 2019-09-20 14:38:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 1,721 ms
コンパイル使用メモリ 177,236 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-09-14 04:41:58
合計ジャッジ時間 3,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

static const int MAX=1e5+1;

int N;
int X;
int a[MAX];

int main(){
    cin >> N >> X;
    for(int i=0;i<N;i++) cin >> a[i];
    sort(a,a+N);
    map<int,int> m;
    int ans=0;
    for(int i=0;i<N;i++){
        m[a[i]]++;
    }
    for(int i=0;i<N;i++){
        if(X-a[i]>=0){
            ans+=m[X-a[i]];
        }
    }
    cout << ans << endl;
}
0