結果
問題 | No.723 2つの数の和 |
ユーザー |
![]() |
提出日時 | 2020-06-08 23:09:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 684 bytes |
コンパイル時間 | 1,946 ms |
コンパイル使用メモリ | 201,580 KB |
最終ジャッジ日時 | 2025-01-11 00:16:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); ++i) #define rep(i, n) REP(i, 0, n) using namespace std; using ll = long long; using ld = long double; template<class T, class U> inline bool chmax(T &a, const U &b) { if(a < b) { a = b; return true; } return false; } template<class T, class U> inline bool chmin(T &a, const U &b) { if(a > b) { a = b; return true; } return false; } int n, x, a[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> x; rep(i, n) cin >> a[i]; map<int, int> cnt; rep(i, n) { cnt[x-a[i]]++; } ll ans = 0; rep(i, n) { ans += cnt[a[i]]; } cout << ans << '\n'; return 0; }