結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2017-08-07 16:40:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 400 bytes |
コンパイル時間 | 626 ms |
コンパイル使用メモリ | 59,480 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 22:29:27 |
合計ジャッジ時間 | 2,333 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<iostream> #include<algorithm> using namespace std; #define int long long #define repeat(i,n) for(int i=0;i<(n);i++) signed main(){ int N, X; cin>> N>> X; int a[N]; repeat(i, N) cin>> a[i]; sort(a, a+N); int ans=0; for(int e: a){ ans+=distance(lower_bound(a, a+N, X-e), upper_bound(a, a+N, X-e)); } cout<< ans<< endl; return 0; }