結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 55 ms
6,236 KB
testcase_04 AC 75 ms
7,008 KB
testcase_05 AC 57 ms
6,512 KB
testcase_06 AC 68 ms
6,684 KB
testcase_07 AC 27 ms
5,408 KB
testcase_08 AC 32 ms
5,448 KB
testcase_09 AC 68 ms
6,564 KB
testcase_10 AC 31 ms
5,660 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 35 ms
5,632 KB
testcase_13 AC 59 ms
6,496 KB
testcase_14 AC 14 ms
4,376 KB
testcase_15 AC 24 ms
5,096 KB
testcase_16 AC 37 ms
5,544 KB
testcase_17 AC 48 ms
5,984 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 63 ms
8,168 KB
testcase_24 AC 18 ms
4,912 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] < 100005)ans += c[x - a[i]];
  }
  cout << ans << endl;
  return 0;
}
0