結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-22 16:09:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 1,790 ms |
| コンパイル使用メモリ | 165,648 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 05:33:34 |
| 合計ジャッジ時間 | 3,203 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
//#include "atcoder/all"
typedef long long int ll;
using namespace std;
// using namespace atcoder;
#define MAXN 100001
ll a[MAXN];
ll cnt[MAXN];
int main() {
ll n, x;
cin >> n >> x;
memset(cnt, 0, sizeof(cnt));
for (int i = 1; i <= n; i++) {
ll ax;
cin >> ax;
a[i] = ax;
cnt[ax]++;
}
ll ret = 0;
for (int i = 1; i <= n; i++) {
if ((x - a[i] < 0) || (x - a[i] > 100000)) continue;
ret += cnt[x - a[i]];
}
cout << ret << endl;
return 0;
}