結果

問題 No.723 2つの数の和
ユーザー autumn-eelautumn-eel
提出日時 2018-08-03 22:37:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 175,288 KB
実行使用メモリ 9,960 KB
最終ジャッジ日時 2023-10-19 21:29:39
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 59 ms
8,124 KB
testcase_04 AC 79 ms
8,684 KB
testcase_05 AC 74 ms
8,916 KB
testcase_06 AC 74 ms
8,660 KB
testcase_07 AC 32 ms
6,720 KB
testcase_08 AC 37 ms
6,944 KB
testcase_09 AC 81 ms
9,388 KB
testcase_10 AC 30 ms
6,360 KB
testcase_11 AC 7 ms
4,436 KB
testcase_12 AC 41 ms
7,444 KB
testcase_13 AC 78 ms
9,960 KB
testcase_14 AC 18 ms
5,720 KB
testcase_15 AC 32 ms
7,012 KB
testcase_16 AC 48 ms
8,252 KB
testcase_17 AC 66 ms
9,240 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 14 ms
4,348 KB
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 50 ms
8,768 KB
testcase_24 AC 22 ms
6,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int a[200000];
int main(){
	int n,x;scanf("%d%d",&n,&x);
	map<int,int>mp;
	rep(i,n){
		scanf("%d",&a[i]);
		mp[a[i]]++;
	}
	ll cnt=0;
	rep(i,n){
		cnt+=mp[x-a[i]];
	}
	cout<<cnt<<endl;
}
0