結果

問題 No.1110 好きな歌
ユーザー cumincumin
提出日時 2020-08-04 15:23:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 967 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 175,832 KB
実行使用メモリ 10,020 KB
最終ジャッジ日時 2023-10-12 18:10:04
合計ジャッジ時間 12,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 3 ms
4,348 KB
testcase_20 AC 3 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 3 ms
4,352 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 191 ms
5,812 KB
testcase_25 AC 234 ms
8,472 KB
testcase_26 AC 122 ms
5,372 KB
testcase_27 AC 231 ms
8,028 KB
testcase_28 AC 133 ms
5,460 KB
testcase_29 AC 273 ms
8,640 KB
testcase_30 AC 131 ms
5,484 KB
testcase_31 AC 83 ms
4,376 KB
testcase_32 AC 305 ms
8,852 KB
testcase_33 AC 150 ms
5,604 KB
testcase_34 AC 207 ms
6,236 KB
testcase_35 AC 321 ms
8,776 KB
testcase_36 AC 36 ms
4,352 KB
testcase_37 AC 93 ms
4,356 KB
testcase_38 AC 273 ms
8,904 KB
testcase_39 AC 199 ms
5,828 KB
testcase_40 AC 255 ms
8,344 KB
testcase_41 AC 21 ms
4,348 KB
testcase_42 AC 293 ms
9,224 KB
testcase_43 AC 275 ms
8,416 KB
testcase_44 AC 324 ms
8,784 KB
testcase_45 AC 323 ms
8,668 KB
testcase_46 AC 322 ms
8,700 KB
testcase_47 AC 337 ms
9,180 KB
testcase_48 AC 333 ms
9,800 KB
testcase_49 AC 315 ms
8,184 KB
testcase_50 AC 326 ms
9,216 KB
testcase_51 AC 331 ms
8,520 KB
testcase_52 AC 324 ms
8,676 KB
testcase_53 AC 328 ms
10,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const int MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,d;
  cin >> n >> d;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  vector<P>p;
  rep(i,n) p.emplace_back(a[i],i);
  sort(p.begin(),p.end());
  sort(a.begin(),a.end());
  
  vector<int>ans(n);
  rep(i,n){
    ans[p[i].second]=upper_bound(a.begin(),a.end(),a[i]-d)-a.begin();
  }
  rep(i,n) cout << ans[i] << endl;
  return 0;
}
0