結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2019-09-20 14:39:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 405 bytes |
コンパイル時間 | 1,659 ms |
コンパイル使用メモリ | 175,368 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-09-14 04:43:09 |
合計ジャッジ時間 | 3,511 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 2 |
ソースコード
#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]; sort(a,a+N); map<long long,long long> m; int 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; }