結果

問題 No.723 2つの数の和
ユーザー Gosu_HirooGosu_Hiroo
提出日時 2018-10-06 11:48:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,400 bytes
コンパイル時間 1,430 ms
コンパイル使用メモリ 167,296 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-20 17:48:18
合計ジャッジ時間 2,908 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 37 ms
8,832 KB
testcase_04 AC 53 ms
9,472 KB
testcase_05 AC 56 ms
9,856 KB
testcase_06 AC 47 ms
9,472 KB
testcase_07 AC 22 ms
7,168 KB
testcase_08 AC 25 ms
7,552 KB
testcase_09 AC 53 ms
10,496 KB
testcase_10 AC 22 ms
6,912 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 30 ms
8,064 KB
testcase_13 AC 67 ms
11,136 KB
testcase_14 AC 19 ms
5,888 KB
testcase_15 AC 28 ms
7,552 KB
testcase_16 AC 41 ms
8,960 KB
testcase_17 AC 56 ms
10,368 KB
testcase_18 AC 7 ms
5,376 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 48 ms
9,600 KB
testcase_24 AC 21 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define gcd __gcd

const double pi = 3.14159265358979323846;


const int INF = 0x3f3f3f3f;
const int MOD = (int)(1e9+7);


map<int ,ll> m;
void _(){
    int n,x;
    ll ans = 0;
    cin >> n >> x;
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        m[t] ++;
    }
    for(auto p : m)
        ans += p.second * m[x - p.first];
    cout << ans;
}


int main() {
#ifdef Debug
    freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin);
    freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}



0