結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-31 06:20:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 1,352 ms |
| コンパイル使用メモリ | 160,160 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-13 20:40:50 |
| 合計ジャッジ時間 | 2,564 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<bits/stdc++.h>
#define print(x) std::cout << x << std::endl
using namespace std;
typedef vector<int> VI;
typedef vector<string> VS;
//container util
#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)
int main(void){
int N,X; cin >> N >> X;
VI a(N,0);
REP(i,N) cin >> a[i];
int cnt[101010] = {0};
REP(i,N) cnt[a[i]]++;
long int ans = 0;
REP(i,N){
int d = X - a[i];
if (0 <= d and d <= 100000) ans += cnt[d];
}
print(ans);
return 0;
}