結果

問題 No.723 2つの数の和
ユーザー croonalullabycroonalullaby
提出日時 2018-12-25 18:42:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 168,224 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-04-08 22:38:56
合計ジャッジ時間 4,834 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 38 ms
6,548 KB
testcase_05 AC 31 ms
6,548 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 15 ms
6,548 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 31 ms
6,548 KB
testcase_14 AC 9 ms
6,548 KB
testcase_15 AC 14 ms
6,548 KB
testcase_16 AC 20 ms
6,548 KB
testcase_17 AC 28 ms
6,548 KB
testcase_18 RE -
testcase_19 AC 33 ms
6,548 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 30 ms
6,548 KB
testcase_24 AC 10 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n, x;
  int m = 1e5;

  cin >> n >> x;

  int a;
  vector<LL> v(m+2);
  REP (i, m + 1) v[i] = 0;
  REP (i, n) {
    cin >> a;
    v[a]++;
  }

  LL ans = 0;
  REP (i, m + 1) {
    if (x - i <= m) ans += v[i] * v[x - i];
  }

  cout << ans << endl;
}
0