結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 50 ms
7,540 KB
testcase_04 AC 66 ms
8,012 KB
testcase_05 AC 61 ms
8,256 KB
testcase_06 AC 67 ms
8,008 KB
testcase_07 AC 28 ms
6,384 KB
testcase_08 AC 32 ms
6,532 KB
testcase_09 AC 69 ms
8,780 KB
testcase_10 AC 28 ms
5,916 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 37 ms
6,916 KB
testcase_13 AC 72 ms
9,348 KB
testcase_14 AC 18 ms
5,504 KB
testcase_15 AC 29 ms
6,524 KB
testcase_16 AC 44 ms
7,680 KB
testcase_17 AC 59 ms
8,596 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 45 ms
8,112 KB
testcase_24 AC 22 ms
5,492 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, x;
	cin >> n >> x;
	vector<int> a(n);
	map<int, int> mp;
	rep(i, n) {
	  cin >> a[i];
	  mp[a[i]]++;
	}
	int res = 0;
	rep(i, n) {
	  res += mp[x - a[i]];
	}
	cout << res << endl;

	return 0;
}

0