結果

問題 No.1110 好きな歌
ユーザー CleyLCleyL
提出日時 2021-11-16 01:10:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 436 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 1,381 ms
コンパイル使用メモリ 76,524 KB
実行使用メモリ 6,344 KB
最終ジャッジ日時 2023-08-21 20:21:26
合計ジャッジ時間 17,582 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 217 ms
5,008 KB
testcase_25 AC 269 ms
5,228 KB
testcase_26 AC 137 ms
4,384 KB
testcase_27 AC 264 ms
5,112 KB
testcase_28 AC 155 ms
4,428 KB
testcase_29 AC 306 ms
5,736 KB
testcase_30 AC 152 ms
4,376 KB
testcase_31 AC 94 ms
4,376 KB
testcase_32 AC 340 ms
5,944 KB
testcase_33 AC 175 ms
4,728 KB
testcase_34 AC 235 ms
5,288 KB
testcase_35 AC 370 ms
6,344 KB
testcase_36 AC 42 ms
4,380 KB
testcase_37 AC 102 ms
4,376 KB
testcase_38 AC 299 ms
5,752 KB
testcase_39 AC 225 ms
4,892 KB
testcase_40 AC 291 ms
5,428 KB
testcase_41 AC 23 ms
4,380 KB
testcase_42 AC 334 ms
5,908 KB
testcase_43 AC 302 ms
5,952 KB
testcase_44 AC 366 ms
6,328 KB
testcase_45 AC 373 ms
6,216 KB
testcase_46 AC 375 ms
6,168 KB
testcase_47 AC 376 ms
6,220 KB
testcase_48 AC 404 ms
6,228 KB
testcase_49 AC 395 ms
6,328 KB
testcase_50 AC 436 ms
6,332 KB
testcase_51 AC 396 ms
6,292 KB
testcase_52 AC 383 ms
6,344 KB
testcase_53 AC 371 ms
6,288 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