結果

問題 No.1110 好きな歌
ユーザー onsen_manjuuu
提出日時 2020-07-12 03:07:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 354 ms / 5,000 ms
コード長 471 bytes
コンパイル時間 1,583 ms
コンパイル使用メモリ 175,444 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-13 19:34:52
合計ジャッジ時間 13,938 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
    int n, d; cin >> n >> d;
    vector<pair<int,int>> a(n);
    for(int i = 0; i < n; i++)cin >> a[i].first, a[i].second = i;
    sort(a.begin(), a.end());
    vector<int> u, ans(n);
    for(auto i : a)u.push_back(i.first);

    for(int i = 0; i < n; i++) {
        ans[a[i].second] = upper_bound(u.begin(), u.end(), u[i] - d) - u.begin();
    }
    for(auto i : ans)cout << i << endl;
}
0