結果

問題 No.723 2つの数の和
ユーザー 👑 CleyL
提出日時 2020-02-10 18:59:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 64,692 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 06:28:44
合計ジャッジ時間 1,695 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
long long nya[200001];
int main(){
    int n,x;cin>>n>>x;
    if(x > 200000){
        cout << 0 << endl;
        return 0;
    }
    for(int i = 0; n > i; i++){
        int z;cin>>z;
        nya[z]++;
    }
    long long ans = 0;
    for(int i = 0; x >= i; i++){
        ans += nya[i]*nya[x-i];
    }
    cout << ans << endl;
}
0