結果

問題 No.723 2つの数の和
ユーザー ninoinuininoinui
提出日時 2020-07-20 13:44:07
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 208,452 KB
実行使用メモリ 9,324 KB
最終ジャッジ日時 2023-08-25 02:41:06
合計ジャッジ時間 4,861 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 60 ms
7,548 KB
testcase_04 AC 79 ms
8,176 KB
testcase_05 AC 74 ms
8,348 KB
testcase_06 AC 77 ms
8,200 KB
testcase_07 AC 34 ms
6,332 KB
testcase_08 AC 37 ms
6,392 KB
testcase_09 AC 83 ms
8,968 KB
testcase_10 AC 32 ms
5,884 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 46 ms
7,088 KB
testcase_13 AC 84 ms
9,324 KB
testcase_14 AC 20 ms
5,468 KB
testcase_15 AC 35 ms
6,616 KB
testcase_16 AC 53 ms
7,636 KB
testcase_17 AC 70 ms
8,760 KB
testcase_18 AC 15 ms
4,380 KB
testcase_19 AC 30 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 62 ms
8,048 KB
testcase_24 AC 25 ms
5,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  map<int, int> MA;
  for (auto a : A) MA[a]++;
  long ans = 0;
  for (auto a : A) ans += MA[X - a];
  cout << ans << "\n";
}
0