結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2018-08-03 22:48:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 611 bytes |
| コンパイル時間 | 1,406 ms |
| コンパイル使用メモリ | 79,988 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 17:34:07 |
| 合計ジャッジ時間 | 1,622 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, x;
cin >> n >> x;
int m = 100001;
vector<int> b(m);
for (int i = 0; i < n; i++) {
int a;
cin >> a;
b[a]++;
}
ll r = 0;
for (int i = 0; i < m; i++) {
int j = x - i;
if (0 <= j && j < m) {
r += (ll)b[i] * b[j];
}
}
cout << r << endl;
return 0;
}
merom686