結果

問題 No.723 2つの数の和
ユーザー るこーそーるこーそー
提出日時 2024-08-23 23:00:40
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 1,208 bytes
コンパイル時間 5,349 ms
コンパイル使用メモリ 308,468 KB
実行使用メモリ 12,456 KB
最終ジャッジ日時 2024-08-23 23:00:49
合計ジャッジ時間 9,108 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvvi vector<vvi>
#define vvvl vector<vvl>

template <class T>
auto debug(const T &vec){
    if constexpr (!std::is_arithmetic_v<typename T::value_type>){
        for (const auto &v : vec)debug<typename T::value_type>(v);
        cout << endl;}
    else{
        for (const auto &e : vec){
            cout << e << " ";}
        cout << endl;}
}

void print(){cout << '\n';}
template <class T, class... Ts>
void print(const T &a, const Ts &...b){
    cout << a;
    (cout << ... << (cout << ' ', b));
    cout << '\n';}

int main() {
    ll n,x;
    cin >> n >> x;

    const ll M=1e5+1;
    vl f(M,0);
    rep(i,n){
        ll a;
        cin >> a;
        f[a]++;
    }

    f=convolution_ll(f,f);
    if (x>=f.size()){
        cout << 0 << endl;
    }else {
        cout << f[x] << endl;
    }
}
0