結果

問題 No.723 2つの数の和
ユーザー granddaifukugranddaifuku
提出日時 2020-07-18 14:06:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 175,172 KB
実行使用メモリ 11,812 KB
最終ジャッジ日時 2023-08-20 17:19:55
合計ジャッジ時間 3,692 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 56 ms
9,176 KB
testcase_04 AC 77 ms
9,816 KB
testcase_05 AC 67 ms
10,184 KB
testcase_06 AC 72 ms
9,904 KB
testcase_07 AC 30 ms
7,468 KB
testcase_08 AC 34 ms
7,528 KB
testcase_09 AC 78 ms
10,992 KB
testcase_10 AC 30 ms
6,960 KB
testcase_11 AC 7 ms
4,460 KB
testcase_12 AC 40 ms
8,484 KB
testcase_13 AC 74 ms
11,812 KB
testcase_14 AC 18 ms
5,920 KB
testcase_15 AC 31 ms
7,536 KB
testcase_16 AC 46 ms
9,540 KB
testcase_17 AC 63 ms
10,756 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 68 ms
10,100 KB
testcase_24 AC 21 ms
6,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll =  long long;
using ld =  long double;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	ll x;
	cin >> n >> x;
	vector<ll> a(n);
	map<ll, int> mp;
	rep(i, n) {
	  cin >> a[i];
	  mp[a[i]]++;
	}
	int res = 0;
	rep(i, n) {
	  if (mp[x - a[i]] > 0) res += mp[x - a[i]];
	}
	cout << res << endl;

	return 0;
}

0