結果

問題 No.723 2つの数の和
ユーザー ManjushriMitra
提出日時 2024-07-27 12:27:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 1,841 ms
コンパイル使用メモリ 176,068 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-07-27 12:27:20
合計ジャッジ時間 4,690 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,m,n) for(int i=m; i<n; ++i)
#define repl(i,m,n) for(ll i=m; i<n; ++i)

int main(){
    int N, X;
    cin >> N >> X;
    vector<int> a(N);
    for(int &aa : a) cin >> aa;

    map<int, int> mp;
    rep(i, 0, N) mp[a[i]]++;

    ll ans = 0LL;
    rep(i, 0, N){
        ans += ll(mp[X - a[i]]);
    }

    cout << ans << endl;
    return 0;
}
0