結果

問題 No.723 2つの数の和
ユーザー chocoruskchocorusk
提出日時 2018-08-03 22:45:13
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 514 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 73,088 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 21:31:26
合計ジャッジ時間 3,037 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 21 ms
4,348 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 28 ms
4,348 KB
testcase_07 AC 13 ms
4,348 KB
testcase_08 AC 15 ms
4,348 KB
testcase_09 AC 28 ms
4,348 KB
testcase_10 RE -
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 16 ms
4,348 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 17 ms
4,348 KB
testcase_19 RE -
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 29 ms
4,348 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	int x;
	cin>>n>>x;
	int a[100001]={};
	for(int i=0; i<n; i++){
		int a1;
		cin>>a1;
		a[a1]++;
	}
	ll ans=0;
	for(int k=0; k<=x; k++){
		ans+=((ll)(a[k]))*((ll)(a[x-k]));
	}
	cout<<ans<<endl;
	return 0;
}
0