結果

問題 No.1110 好きな歌
ユーザー yuya1234yuya1234
提出日時 2020-07-10 23:00:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 318 ms / 5,000 ms
コード長 1,055 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 170,528 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 21:24:53
合計ジャッジ時間 10,861 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 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 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 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 169 ms
5,376 KB
testcase_25 AC 205 ms
5,376 KB
testcase_26 AC 111 ms
5,376 KB
testcase_27 AC 209 ms
5,376 KB
testcase_28 AC 118 ms
5,376 KB
testcase_29 AC 262 ms
5,376 KB
testcase_30 AC 121 ms
5,376 KB
testcase_31 AC 73 ms
5,376 KB
testcase_32 AC 268 ms
5,376 KB
testcase_33 AC 142 ms
5,376 KB
testcase_34 AC 182 ms
5,376 KB
testcase_35 AC 276 ms
5,376 KB
testcase_36 AC 30 ms
5,376 KB
testcase_37 AC 82 ms
5,376 KB
testcase_38 AC 240 ms
5,376 KB
testcase_39 AC 187 ms
5,376 KB
testcase_40 AC 223 ms
5,376 KB
testcase_41 AC 18 ms
5,376 KB
testcase_42 AC 245 ms
5,376 KB
testcase_43 AC 244 ms
5,376 KB
testcase_44 AC 287 ms
5,376 KB
testcase_45 AC 318 ms
5,376 KB
testcase_46 AC 294 ms
5,376 KB
testcase_47 AC 308 ms
5,376 KB
testcase_48 AC 297 ms
5,376 KB
testcase_49 AC 272 ms
5,376 KB
testcase_50 AC 300 ms
5,376 KB
testcase_51 AC 298 ms
5,376 KB
testcase_52 AC 294 ms
5,376 KB
testcase_53 AC 299 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  yuya1234
*    created: 10.07.2020 21:42:50
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))




int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int n,d;
  cin>>n>>d;

  int a[n],ans;
  vector<int> v;
  REP(i,n)
  {
    cin>>a[i];
    v.emplace_back(a[i]);
  }   

  SORT(v);

  vector<int>::iterator position;
  int idx_lower;
  REP(i,n)
  {
    ans=0;
    if(a[i]>d && n!=1)
    {
      position = lower_bound(v.begin(), v.end(), a[i]-d+1);
      idx_lower = distance(v.begin(), position);
      ans=idx_lower;
    }

    cout<<ans<<endl;
  }

  return 0;
}
0