結果

問題 No.723 2つの数の和
ユーザー umezoumezo
提出日時 2020-09-16 04:59:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 205,748 KB
実行使用メモリ 11,244 KB
最終ジャッジ日時 2023-09-04 03:19:41
合計ジャッジ時間 4,204 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 50 ms
8,888 KB
testcase_04 AC 79 ms
9,640 KB
testcase_05 AC 77 ms
9,936 KB
testcase_06 AC 68 ms
9,632 KB
testcase_07 AC 26 ms
6,904 KB
testcase_08 AC 32 ms
7,600 KB
testcase_09 AC 63 ms
8,652 KB
testcase_10 AC 29 ms
6,844 KB
testcase_11 AC 7 ms
4,612 KB
testcase_12 AC 34 ms
7,224 KB
testcase_13 AC 96 ms
11,244 KB
testcase_14 AC 22 ms
6,108 KB
testcase_15 AC 40 ms
7,764 KB
testcase_16 AC 60 ms
9,304 KB
testcase_17 AC 78 ms
10,468 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 AC 13 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 59 ms
9,660 KB
testcase_24 AC 26 ms
6,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int n,x;
  cin>>n>>x;
  
  map<int,ll> m;
  rep(i,n){
    ll y;
    scanf("%lld", &y);
    m[y]++;
  }
  
  ll sum=0;
  for(auto t:m){
    if(t.first>2*x) break;
    else sum+=t.second*m[x-t.first];
  }
  cout<<sum<<endl;
  return 0;
}
0