結果

問題 No.1110 好きな歌
ユーザー booya1915
提出日時 2020-07-10 21:51:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 152 ms / 5,000 ms
コード長 682 bytes
コンパイル時間 1,560 ms
コンパイル使用メモリ 169,292 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-10-11 08:53:38
合計ジャッジ時間 7,412 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int long long
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

signed main() {
    int n, d;
    cin >> n >> d;
    int a[n];
    rep (i, 0, n) cin >> a[i];
    int b[n];
    rep (i, 0, n) b[i] = a[i];
    sort (b, b + n);
    rep (i, 0, n) {
        int sum = upper_bound (b, b + n, a[i] - d) - b;
        int ans = max ((ll)0, sum);
        cout << ans << "\n";
    }
}
0