結果
問題 | No.723 2つの数の和 |
ユーザー |
![]() |
提出日時 | 2019-09-20 14:42:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 1,758 ms |
コンパイル使用メモリ | 172,876 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-09-14 04:45:50 |
合計ジャッジ時間 | 3,685 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; static const int MAX=1e5+1; int N; int X; int a[MAX]; int main(){ cin >> N >> X; for(int i=0;i<N;i++) cin >> a[i]; map<long long,long long> m; long long ans=0; for(int i=0;i<N;i++){ m[a[i]]++; } for(int i=0;i<N;i++){ if(X-a[i]>=0){ ans+=m[X-a[i]]; } } cout << ans << endl; }