結果

問題 No.1110 好きな歌
ユーザー reopisreopis
提出日時 2020-07-11 15:59:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 359 ms / 5,000 ms
コード長 878 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 167,944 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 05:35:56
合計ジャッジ時間 12,260 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 4 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 214 ms
5,376 KB
testcase_25 AC 256 ms
5,376 KB
testcase_26 AC 132 ms
5,376 KB
testcase_27 AC 251 ms
5,376 KB
testcase_28 AC 142 ms
5,376 KB
testcase_29 AC 298 ms
5,376 KB
testcase_30 AC 142 ms
5,376 KB
testcase_31 AC 88 ms
5,376 KB
testcase_32 AC 326 ms
5,376 KB
testcase_33 AC 155 ms
5,376 KB
testcase_34 AC 220 ms
5,376 KB
testcase_35 AC 330 ms
5,376 KB
testcase_36 AC 37 ms
5,376 KB
testcase_37 AC 101 ms
5,376 KB
testcase_38 AC 289 ms
5,376 KB
testcase_39 AC 214 ms
5,376 KB
testcase_40 AC 259 ms
5,376 KB
testcase_41 AC 23 ms
5,376 KB
testcase_42 AC 304 ms
5,376 KB
testcase_43 AC 297 ms
5,376 KB
testcase_44 AC 350 ms
5,376 KB
testcase_45 AC 346 ms
5,376 KB
testcase_46 AC 346 ms
5,376 KB
testcase_47 AC 359 ms
5,376 KB
testcase_48 AC 350 ms
5,376 KB
testcase_49 AC 329 ms
5,376 KB
testcase_50 AC 354 ms
5,376 KB
testcase_51 AC 345 ms
5,376 KB
testcase_52 AC 357 ms
5,376 KB
testcase_53 AC 359 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;
ll dp[110][100100];
 

int main(){
   int n,d;
   cin >> n >> d;
   vector<int>a(n),b(n);
   rep(i,n){
       cin >> a[i];
       b[i]=a[i];
   }
   sort(b.begin(),b.end());
    rep(i,n){
        if(a[i]-d<1){
            cout << 0 << endl;
            continue;
        }
        int ans = upper_bound(b.begin(),b.end(),a[i]-d)-b.begin();
        cout << ans <<endl;
    }
}
0