結果

問題 No.723 2つの数の和
ユーザー tadanoningentadanoningen
提出日時 2020-10-08 02:49:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 725 ms
コンパイル使用メモリ 85,484 KB
実行使用メモリ 8,180 KB
最終ジャッジ日時 2023-09-27 11:34:39
合計ジャッジ時間 2,614 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 51 ms
6,272 KB
testcase_04 AC 73 ms
6,996 KB
testcase_05 AC 61 ms
6,476 KB
testcase_06 AC 70 ms
6,636 KB
testcase_07 AC 27 ms
5,144 KB
testcase_08 AC 32 ms
5,444 KB
testcase_09 AC 66 ms
6,676 KB
testcase_10 AC 33 ms
5,620 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 36 ms
5,636 KB
testcase_13 AC 60 ms
6,380 KB
testcase_14 AC 14 ms
4,380 KB
testcase_15 AC 24 ms
4,972 KB
testcase_16 AC 38 ms
5,676 KB
testcase_17 AC 48 ms
6,112 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 63 ms
8,180 KB
testcase_24 AC 19 ms
4,768 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++){
    if(x-a[i] >= 0 && x-a[i] < 100001)ans += c[x - a[i]];
  }
  cout << ans << endl;
  return 0;
}
0