結果

問題 No.723 2つの数の和
ユーザー AC2KAC2K
提出日時 2023-07-02 21:28:32
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 3,108 bytes
コンパイル時間 5,875 ms
コンパイル使用メモリ 305,584 KB
実行使用メモリ 12,508 KB
最終ジャッジ日時 2023-09-23 17:17:30
合計ジャッジ時間 10,798 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
12,152 KB
testcase_01 AC 87 ms
12,276 KB
testcase_02 AC 87 ms
12,304 KB
testcase_03 AC 88 ms
12,196 KB
testcase_04 AC 89 ms
12,204 KB
testcase_05 AC 89 ms
12,136 KB
testcase_06 AC 88 ms
12,268 KB
testcase_07 AC 87 ms
12,136 KB
testcase_08 AC 87 ms
12,232 KB
testcase_09 AC 89 ms
12,184 KB
testcase_10 AC 87 ms
12,260 KB
testcase_11 AC 87 ms
12,312 KB
testcase_12 AC 88 ms
12,200 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 88 ms
12,308 KB
testcase_19 AC 91 ms
12,136 KB
testcase_20 AC 87 ms
12,144 KB
testcase_21 AC 87 ms
12,156 KB
testcase_22 AC 87 ms
12,160 KB
testcase_23 AC 89 ms
12,196 KB
testcase_24 AC 88 ms
12,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "h.cpp"
#include <atcoder/all>
#line 2 "library/src/stream.hpp"
#include <ctype.h>
#include <stdio.h>
#include <string>
namespace kyopro {

/**
 *  整数の入出力
 */
template <typename T> constexpr inline void readint(T& a) {
    a = 0;
    bool is_negative = false;
    char c = getchar_unlocked();
    while (isspace(c)) {
        c = getchar_unlocked();
    }
    if (c == '-') is_negative = true, c = getchar_unlocked();
    while (isdigit(c)) {
        a = 10 * a + (c - '0');
        c = getchar_unlocked();
    }
    if (is_negative) a *= -1;
}
template <typename Head, typename... Tail>
constexpr inline void readint(Head& head, Tail&... tail) {
    readint(head);
    readint(tail...);
}

template <typename T> void write_int(T a) {
    if (!a) {
        putchar_unlocked('0');
        putchar_unlocked('\n');
        return;
    }
    if (a < 0) putchar_unlocked('-'), a *= -1;
    char s[37];
    int now = 37;
    while (a) {
        s[--now] = (char)'0' + a % 10;
        a /= 10;
    }
    while (now < 37) putchar_unlocked(s[now++]);
}
template <typename T> constexpr inline void putint(T a) {
    if (!a) {
        putchar_unlocked('0');
        putchar_unlocked('\n');
        return;
    }
    if (a < 0) putchar_unlocked('-'), a *= -1;
    char s[37];
    int now = 37;
    while (a) {
        s[--now] = (char)'0' + a % 10;
        a /= 10;
    }
    while (now < 37) putchar_unlocked(s[now++]);
    putchar_unlocked('\n');
}
template <typename Head, typename... Tail>
constexpr inline void putint(Head head, Tail... tail) {
    putint(head);
    putint(tail...);
}

/**
 * 文字列の入出力
 */

void readstr(std::string& str) {
    char c = getchar_unlocked();
    while (isspace(c)) c = getchar_unlocked();
    while (!isspace(c)) {
        str += c;
        c = getchar_unlocked();
    }
}
void putstr(const std::string& str) {
    for (auto c : str) {
        putchar_unlocked(c);
    }
    putchar_unlocked('\n');
}

};  // namespace kyopro

/**
 * @brief fastIO
 */
#line 2 "library/src/template.hpp"
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(x) std::begin(x), std::end(x)
#define popcount(x) __builtin_popcountll(x)
using i128 = __int128_t;
using ll = long long;
using ld = long double;
using graph = std::vector<std::vector<int>>;
using P = std::pair<int, int>;
constexpr int inf = 1e9;
constexpr ll infl = 1e18;
constexpr ld eps = 1e-6;
const long double pi = acos(-1);
constexpr uint64_t MOD = 1e9 + 7;
constexpr uint64_t MOD2 = 998244353;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
template <typename T1, typename T2> constexpr inline bool chmax(T1& a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> constexpr inline bool chmin(T1& a, T2 b) {
    return a > b && (a = b, true);
}
#line 4 "h.cpp"

using namespace std;
using namespace kyopro;

int main() {
    int n, x;
    readint(n, x);
    vector<ll> a((int)1e5 + 1);
    rep(i, n) {
        int v;
        readint(v);
        ++a[v];
    }
    a = atcoder::convolution_ll(a, a);
    putint(a[x]);
}
0