結果

問題 No.723 2つの数の和
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2018-08-12 13:22:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 82,752 KB
実行使用メモリ 11,888 KB
最終ジャッジ日時 2023-10-24 16:09:33
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 73 ms
9,248 KB
testcase_04 AC 99 ms
10,040 KB
testcase_05 AC 89 ms
10,304 KB
testcase_06 AC 97 ms
10,040 KB
testcase_07 AC 38 ms
7,472 KB
testcase_08 AC 44 ms
7,740 KB
testcase_09 AC 101 ms
11,096 KB
testcase_10 AC 36 ms
7,000 KB
testcase_11 AC 9 ms
4,652 KB
testcase_12 AC 51 ms
8,368 KB
testcase_13 AC 101 ms
11,888 KB
testcase_14 AC 21 ms
6,224 KB
testcase_15 AC 38 ms
7,848 KB
testcase_16 AC 58 ms
9,512 KB
testcase_17 AC 79 ms
10,832 KB
testcase_18 AC 18 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 1 ms
4,348 KB
testcase_23 AC 72 ms
10,304 KB
testcase_24 AC 26 ms
6,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  ll N,X,res=0;
  cin >> N >> X;
  vector<ll> a(N+1);
  map<ll,ll> mp;
  REP(i,N){
    cin >> a[i];
    mp[a[i]]++;
  }
  REP(i,N){
    res += mp[X-a[i]];
  }
  cout << res << endl;
  return 0;
}

0