結果

問題 No.723 2つの数の和
ユーザー tadanoningentadanoningen
提出日時 2020-10-08 02:43:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 84,312 KB
実行使用メモリ 9,384 KB
最終ジャッジ日時 2023-09-27 11:34:32
合計ジャッジ時間 3,088 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 63 ms
7,592 KB
testcase_04 AC 91 ms
8,092 KB
testcase_05 AC 80 ms
8,324 KB
testcase_06 AC 78 ms
8,204 KB
testcase_07 AC 34 ms
6,192 KB
testcase_08 AC 40 ms
6,336 KB
testcase_09 AC 90 ms
8,876 KB
testcase_10 AC 33 ms
5,788 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 48 ms
6,928 KB
testcase_13 AC 91 ms
9,384 KB
testcase_14 AC 21 ms
5,296 KB
testcase_15 AC 37 ms
6,516 KB
testcase_16 AC 57 ms
7,680 KB
testcase_17 AC 71 ms
8,496 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 62 ms
8,000 KB
testcase_24 AC 25 ms
5,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> a(n);
  map<int,int> c;
  
  for(int i=0;i < n;i++){
    cin >> a[i];
    c[a[i]]++;
  }

  int ans = 0;

  for(int i=0;i < n;i++){
    ans += c[x - a[i]];
  }
  cout << ans << endl;
  return 0;
}
0