結果
問題 |
No.723 2つの数の和
|
ユーザー |
|
提出日時 | 2018-08-03 22:26:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 498 bytes |
コンパイル時間 | 1,390 ms |
コンパイル使用メモリ | 167,548 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-19 17:28:50 |
合計ジャッジ時間 | 2,255 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, x; cin >> n >> x; vector<int> cnt(100001, 0); for (int i = 0; i < n; i++) { int a; cin >> a; cnt[a]++; } ll ans = 0; for (int i = 0; i <= 100000; i++) { int tar = x - i; if (tar < 0 || tar > 100000) continue; ans += cnt[i] * cnt[tar]; } cout << ans << endl; return 0; }