結果

問題 No.723 2つの数の和
ユーザー beetbeet
提出日時 2018-08-03 22:21:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 1,850 ms
コンパイル使用メモリ 177,644 KB
実行使用メモリ 12,044 KB
最終ジャッジ日時 2023-10-19 21:25:50
合計ジャッジ時間 4,726 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 75 ms
9,404 KB
testcase_04 AC 103 ms
10,196 KB
testcase_05 AC 91 ms
10,460 KB
testcase_06 AC 99 ms
10,196 KB
testcase_07 AC 40 ms
7,556 KB
testcase_08 AC 46 ms
7,820 KB
testcase_09 AC 109 ms
11,252 KB
testcase_10 AC 38 ms
7,044 KB
testcase_11 AC 8 ms
4,696 KB
testcase_12 AC 54 ms
8,412 KB
testcase_13 AC 120 ms
12,044 KB
testcase_14 AC 22 ms
6,268 KB
testcase_15 AC 39 ms
7,892 KB
testcase_16 AC 60 ms
9,668 KB
testcase_17 AC 83 ms
10,988 KB
testcase_18 AC 17 ms
4,348 KB
testcase_19 AC 34 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 73 ms
10,460 KB
testcase_24 AC 28 ms
6,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n,x;
  cin>>n>>x;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  map<Int, Int> cnt;
  Int ans=0;
  for(Int i=0;i<n;i++){
    cnt[a[i]]++;
  } 
  for(Int i=0;i<n;i++){
    ans+=cnt[x-a[i]];
  }
  cout<<ans<<endl;
  return 0;
}
0