結果

問題 No.723 2つの数の和
ユーザー uw_yu1rabbituw_yu1rabbit
提出日時 2020-08-21 20:11:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 1,087 ms
コンパイル使用メモリ 92,776 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-04-27 03:23:17
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
純コード判定待ち
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 55 ms
9,344 KB
testcase_04 AC 74 ms
10,112 KB
testcase_05 AC 67 ms
10,368 KB
testcase_06 AC 71 ms
10,112 KB
testcase_07 AC 30 ms
7,424 KB
testcase_08 AC 35 ms
7,680 KB
testcase_09 AC 77 ms
11,136 KB
testcase_10 AC 29 ms
6,940 KB
testcase_11 AC 7 ms
6,944 KB
testcase_12 AC 39 ms
8,320 KB
testcase_13 AC 75 ms
11,904 KB
testcase_14 AC 17 ms
6,940 KB
testcase_15 AC 31 ms
7,808 KB
testcase_16 AC 48 ms
9,472 KB
testcase_17 AC 63 ms
10,880 KB
testcase_18 AC 8 ms
6,944 KB
testcase_19 AC 12 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 53 ms
10,240 KB
testcase_24 AC 21 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include<iostream>
#include<map>
#include<vector>

using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64, i64>;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i32 n, x;
    cin >> n >> x;
    vector<i32> a(n);
    map<i32, i32> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    i32 ans = 0;
    rep(i, n) {
        ans += mp[x - a[i]];
    }
    cout << ans << endl;
}
0