結果

問題 No.1110 好きな歌
ユーザー Novi
提出日時 2020-07-11 14:19:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 306 ms / 5,000 ms
コード長 816 bytes
コンパイル時間 1,592 ms
コンパイル使用メモリ 173,608 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2024-10-13 01:24:28
合計ジャッジ時間 10,834 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n,d;
    cin>>n>>d;
    vector<long long>a(0);
    for(int i=0; i<n; i++){
        long long aa; cin>>aa;
        a.emplace_back(aa);
    }
    vector<long long>b(0);
    for(int i=0; i<n; i++){
        b.emplace_back((d+a[i])*(-1));
    }
    sort(b.begin(), b.end());
    for(int i=0; i<n; i++){
        long long cnt= a[i]*(-1);
        auto ans=lower_bound(b.begin(), b.end(), cnt);
        cout<<n-distance(b.begin(),ans)<<endl;
    }

    return 0;
}
0