結果

問題 No.723 2つの数の和
ユーザー f_t_iktf_t_ikt
提出日時 2018-11-08 23:41:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 1,148 bytes
コンパイル時間 3,600 ms
コンパイル使用メモリ 174,440 KB
実行使用メモリ 16,288 KB
最終ジャッジ日時 2023-08-13 04:35:17
合計ジャッジ時間 5,320 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
15,812 KB
testcase_01 AC 62 ms
15,796 KB
testcase_02 AC 63 ms
15,904 KB
testcase_03 AC 66 ms
12,948 KB
testcase_04 AC 80 ms
12,156 KB
testcase_05 AC 78 ms
14,440 KB
testcase_06 AC 74 ms
12,864 KB
testcase_07 AC 57 ms
13,592 KB
testcase_08 AC 58 ms
13,108 KB
testcase_09 AC 82 ms
14,608 KB
testcase_10 AC 53 ms
10,712 KB
testcase_11 AC 43 ms
12,772 KB
testcase_12 AC 63 ms
14,036 KB
testcase_13 AC 92 ms
16,288 KB
testcase_14 AC 64 ms
15,904 KB
testcase_15 AC 69 ms
16,028 KB
testcase_16 AC 72 ms
15,868 KB
testcase_17 AC 82 ms
16,212 KB
testcase_18 AC 70 ms
16,192 KB
testcase_19 AC 101 ms
16,188 KB
testcase_20 AC 62 ms
15,808 KB
testcase_21 AC 63 ms
15,792 KB
testcase_22 AC 62 ms
15,828 KB
testcase_23 AC 69 ms
10,072 KB
testcase_24 AC 61 ms
15,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,x;
    cin>>n>>x;
    VI(a,n);
    map<int,int> map;
    rep(i,n)map[a[i]]++;
    int ans=0;
    rep(i,100001)ans+=map[i]*map[x-i];
    cout<<ans<<endl;
}
0