結果

問題 No.1110 好きな歌
ユーザー abc3abc3
提出日時 2020-07-11 02:29:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 407 ms / 5,000 ms
コード長 980 bytes
コンパイル時間 1,796 ms
コンパイル使用メモリ 170,964 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 05:31:45
合計ジャッジ時間 13,651 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,948 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 3 ms
6,944 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 3 ms
6,944 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 3 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 230 ms
6,940 KB
testcase_25 AC 275 ms
6,940 KB
testcase_26 AC 144 ms
6,940 KB
testcase_27 AC 284 ms
6,940 KB
testcase_28 AC 160 ms
6,940 KB
testcase_29 AC 322 ms
6,944 KB
testcase_30 AC 153 ms
6,944 KB
testcase_31 AC 97 ms
6,944 KB
testcase_32 AC 364 ms
6,944 KB
testcase_33 AC 180 ms
6,940 KB
testcase_34 AC 240 ms
6,944 KB
testcase_35 AC 376 ms
6,940 KB
testcase_36 AC 40 ms
6,940 KB
testcase_37 AC 108 ms
6,944 KB
testcase_38 AC 312 ms
6,940 KB
testcase_39 AC 232 ms
6,944 KB
testcase_40 AC 307 ms
6,944 KB
testcase_41 AC 24 ms
6,940 KB
testcase_42 AC 360 ms
6,940 KB
testcase_43 AC 322 ms
6,944 KB
testcase_44 AC 391 ms
6,944 KB
testcase_45 AC 376 ms
6,944 KB
testcase_46 AC 390 ms
6,944 KB
testcase_47 AC 386 ms
6,940 KB
testcase_48 AC 398 ms
6,940 KB
testcase_49 AC 362 ms
6,940 KB
testcase_50 AC 398 ms
6,940 KB
testcase_51 AC 367 ms
6,944 KB
testcase_52 AC 407 ms
6,940 KB
testcase_53 AC 402 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N,D;
  cin>>N>>D;
  vector<int>A(N);
  vector<int>B(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
    B[i]=A[i];
  }
  sort(B.begin(),B.end());
  for(int i=0;i<N;i++){
    int left=-1,right=N;
    while(right-left>1){
      int mid=(right+left)/2;
      if(B[mid]>A[i]-D){right=mid;}
      else {left=mid;}
    }cout<<left+1<<endl;
    //cout<<max(0,left)<<endl;
  }
  
  return 0;
}
0