結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-19 22:22:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 1,800 ms |
| コンパイル使用メモリ | 172,772 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 11:51:59 |
| 合計ジャッジ時間 | 3,553 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int N,X; cin >> N >> X;
vector<int> a(N);
rep(i,N) cin >> a[i];
sort(a.begin(), a.end());
ll ans = 0;
rep(i,N) ans += upper_bound(a.begin(), a.end(), X - a[i]) - lower_bound(a.begin(), a.end(), X - a[i]);
cout << ans << endl;
}