結果

問題 No.723 2つの数の和
ユーザー youthfuldays072youthfuldays072
提出日時 2018-10-14 19:07:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,222 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 100,888 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 20:18:59
合計ジャッジ時間 3,050 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 22 ms
6,944 KB
testcase_04 AC 27 ms
6,944 KB
testcase_05 AC 25 ms
6,940 KB
testcase_06 AC 26 ms
6,940 KB
testcase_07 AC 12 ms
6,944 KB
testcase_08 AC 14 ms
6,944 KB
testcase_09 AC 27 ms
6,944 KB
testcase_10 AC 12 ms
6,944 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 16 ms
6,944 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 16 ms
6,940 KB
testcase_19 AC 31 ms
6,944 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 29 ms
6,940 KB
testcase_24 AC 10 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int tb[1000100];

int main()
{
	int n, x; cin >> n >> x;

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		int buf; cin >> buf;
		a[i] = buf;
		tb[buf]++;
	}
	
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		if (x - a[i] >= 0) {
			ans += (tb[x - a[i]]);
		}
		
	}

	cout << ans << endl;

	return 0;

}
0