結果

問題 No.1110 好きな歌
ユーザー CleyLCleyL
提出日時 2021-11-16 01:10:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 394 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 950 ms
コンパイル使用メモリ 76,528 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-09 02:23:27
合計ジャッジ時間 13,918 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 4 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 229 ms
6,940 KB
testcase_25 AC 284 ms
6,944 KB
testcase_26 AC 145 ms
6,944 KB
testcase_27 AC 276 ms
6,944 KB
testcase_28 AC 163 ms
6,940 KB
testcase_29 AC 323 ms
6,940 KB
testcase_30 AC 158 ms
6,940 KB
testcase_31 AC 97 ms
6,944 KB
testcase_32 AC 353 ms
6,940 KB
testcase_33 AC 185 ms
6,940 KB
testcase_34 AC 249 ms
6,940 KB
testcase_35 AC 383 ms
6,944 KB
testcase_36 AC 43 ms
6,940 KB
testcase_37 AC 108 ms
6,944 KB
testcase_38 AC 320 ms
6,940 KB
testcase_39 AC 239 ms
6,944 KB
testcase_40 AC 309 ms
6,944 KB
testcase_41 AC 24 ms
6,944 KB
testcase_42 AC 357 ms
6,944 KB
testcase_43 AC 317 ms
6,940 KB
testcase_44 AC 389 ms
6,944 KB
testcase_45 AC 394 ms
6,940 KB
testcase_46 AC 389 ms
6,940 KB
testcase_47 AC 392 ms
6,944 KB
testcase_48 AC 391 ms
6,944 KB
testcase_49 AC 388 ms
6,940 KB
testcase_50 AC 390 ms
6,940 KB
testcase_51 AC 394 ms
6,944 KB
testcase_52 AC 389 ms
6,944 KB
testcase_53 AC 390 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,d;cin>>n>>d;
  vector<pair<int,int>> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i].first;
    A[i].second = i;
  }
  sort(A.begin(),A.end());
  int nw = 0;
  vector<pair<int,int>> B(n);
  for(int i = 0; n > i; i++){
    while(A[i].first-A[nw].first >= d){
      nw++;
    }
    B[i] = {A[i].second,nw};
  }
  sort(B.begin(),B.end());
  for(int i = 0; n > i; i++){
    cout << B[i].second << endl;
  }
}
0