結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-11-07 18:27:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 404 bytes |
コンパイル時間 | 1,387 ms |
コンパイル使用メモリ | 173,520 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-20 20:49:44 |
合計ジャッジ時間 | 2,677 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 15 WA * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t n, x; cin >> n >> x; vector<int64_t> as(n); for(auto&a:as){ cin>>a; } sort(as.begin(),as.end()); int64_t ans = 0; for(auto&a:as){ int64_t b=x-a; ans+=distance(lower_bound(as.begin(),as.end(),b),upper_bound(as.begin(),as.end(),b))-(a==b); } cout<<ans<<endl; return 0; }