結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
kekenx
|
| 提出日時 | 2020-02-18 16:40:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 1,711 ms |
| コンパイル使用メモリ | 167,572 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 15:38:37 |
| 合計ジャッジ時間 | 4,599 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 RE * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int cnt[100005];
int main() {
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n; ++i) cnt[a[i]]++;
ll ans = 0;
for (int i = 0; i < n; ++i) {
int d = x - a[i];
if (d >= 0) ans += cnt[d];
}
cout << ans << endl;
return 0;
}
kekenx