結果

問題 No.1110 好きな歌
ユーザー YugimnYugimn
提出日時 2022-05-11 01:29:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 756 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 3,798 ms
コンパイル使用メモリ 229,148 KB
実行使用メモリ 6,496 KB
最終ジャッジ日時 2023-09-25 10:11:11
合計ジャッジ時間 27,043 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 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 3 ms
4,376 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 4 ms
4,380 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 427 ms
4,948 KB
testcase_25 AC 522 ms
5,460 KB
testcase_26 AC 264 ms
4,376 KB
testcase_27 AC 515 ms
5,192 KB
testcase_28 AC 289 ms
4,500 KB
testcase_29 AC 613 ms
5,728 KB
testcase_30 AC 287 ms
4,648 KB
testcase_31 AC 173 ms
4,500 KB
testcase_32 AC 675 ms
6,032 KB
testcase_33 AC 331 ms
4,672 KB
testcase_34 AC 451 ms
5,296 KB
testcase_35 AC 717 ms
6,252 KB
testcase_36 AC 72 ms
4,376 KB
testcase_37 AC 194 ms
4,380 KB
testcase_38 AC 601 ms
5,816 KB
testcase_39 AC 433 ms
4,940 KB
testcase_40 AC 561 ms
5,412 KB
testcase_41 AC 39 ms
4,380 KB
testcase_42 AC 639 ms
5,988 KB
testcase_43 AC 592 ms
5,748 KB
testcase_44 AC 726 ms
6,264 KB
testcase_45 AC 737 ms
6,244 KB
testcase_46 AC 727 ms
6,344 KB
testcase_47 AC 756 ms
6,256 KB
testcase_48 AC 738 ms
6,260 KB
testcase_49 AC 702 ms
6,496 KB
testcase_50 AC 737 ms
6,320 KB
testcase_51 AC 715 ms
6,268 KB
testcase_52 AC 738 ms
6,208 KB
testcase_53 AC 731 ms
6,316 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:12: 警告: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    9 | void print(auto a){
      |            ^~~~
main.cpp:13:13: 警告: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
   13 | void prints(auto a){
      |             ^~~~
main.cpp:21:13: 警告: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
   21 | void printl(auto a){
      |             ^~~~

ソースコード

diff #

//Normal

#define _GLIBCXX_DEBUG
#define ll long long
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

void print(auto a){
  cout << a;
}

void prints(auto a){
  cout << a << " ";
}

void prints(){
  cout << " ";
}

void printl(auto a){
  cout << a << endl;
}

void printl(){
  cout << endl;
}

void fix(int n){
  cout << fixed << setprecision(n);
}

int siz(string s){
  return (int)s.size();
}

int main(){
  int N, D; cin >> N >> D;
  vector<ll> A(N), 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 ng = -1, ok = N;

    while(ng+1 < ok){
      int mid = (ng+ok)/2;

      D <= A[i]-B[mid] ? ng = mid : ok = mid;
    }

    printl(ok);
  }

  return 0;
}
0