結果

問題 No.1110 好きな歌
ユーザー NewGardenNewGarden
提出日時 2020-07-10 21:37:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 857 bytes
コンパイル時間 2,049 ms
コンパイル使用メモリ 101,436 KB
実行使用メモリ 6,472 KB
最終ジャッジ日時 2023-08-01 16:57:56
合計ジャッジ時間 6,951 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 73 ms
4,876 KB
testcase_25 AC 89 ms
5,512 KB
testcase_26 AC 49 ms
4,380 KB
testcase_27 AC 90 ms
5,100 KB
testcase_28 AC 50 ms
4,384 KB
testcase_29 AC 111 ms
5,740 KB
testcase_30 AC 47 ms
4,384 KB
testcase_31 AC 30 ms
4,380 KB
testcase_32 AC 120 ms
5,932 KB
testcase_33 AC 52 ms
4,576 KB
testcase_34 AC 76 ms
4,832 KB
testcase_35 AC 113 ms
6,132 KB
testcase_36 AC 13 ms
4,380 KB
testcase_37 AC 36 ms
4,380 KB
testcase_38 AC 111 ms
5,944 KB
testcase_39 AC 79 ms
4,924 KB
testcase_40 AC 88 ms
5,360 KB
testcase_41 AC 9 ms
4,384 KB
testcase_42 AC 104 ms
6,048 KB
testcase_43 AC 108 ms
5,772 KB
testcase_44 AC 119 ms
6,472 KB
testcase_45 AC 128 ms
6,156 KB
testcase_46 AC 125 ms
6,200 KB
testcase_47 AC 135 ms
6,244 KB
testcase_48 AC 129 ms
6,264 KB
testcase_49 AC 109 ms
6,472 KB
testcase_50 AC 122 ms
6,260 KB
testcase_51 AC 118 ms
6,444 KB
testcase_52 AC 126 ms
6,260 KB
testcase_53 AC 136 ms
6,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

int main(){
  ll n,d;
  cin >> n >> d;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  auto b = a;
  sort(b.begin(),b.end());
  rep(i,n){
    int ans = upper_bound(b.begin(),b.end(),a[i]-d) - b.begin();
    cout << ans << ln;
  }

  return 0;
}
0