結果
問題 | No.723 2つの数の和 |
ユーザー |
![]() |
提出日時 | 2018-10-06 11:48:57 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 80 ms / 2,000 ms |
コード長 | 1,400 bytes |
コンパイル時間 | 1,489 ms |
コンパイル使用メモリ | 166,908 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-10-12 13:44:39 |
合計ジャッジ時間 | 3,532 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define tr(container, it) \ for (auto it = container.begin(); it != container.end(); it++) #define scontains(c, x) ((c).find(x) != (c).end()) //O(log n) #define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n) #define ill(_x) ll _x;scanf("%lld",&_x); #define idb(_x) double _x;scanf("%lf",&_x); #define all(x) (x).begin(),(x).end() #define pll pair<ll,ll> #define mll map<ll,ll> #define vll vector<ll> #define sll set<ll> #define vs vector<string> #define in0(x, a, b)((x)>=a && (x)<=b ) #define in1(x, a, b)((x)>a && (x)<b) #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) #define gcd __gcd const double pi = 3.14159265358979323846; const int INF = 0x3f3f3f3f; const int MOD = (int)(1e9+7); map<int ,ll> m; void _(){ int n,x; ll ans = 0; cin >> n >> x; for (int i = 0; i < n; ++i) { int t; cin >> t; m[t] ++; } for(auto p : m) ans += p.second * m[x - p.first]; cout << ans; } int main() { #ifdef Debug freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin); freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); _(); return 0; }