結果

問題 No.1110 好きな歌
ユーザー motmot
提出日時 2020-07-10 21:57:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 634 ms / 5,000 ms
コード長 830 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 95,104 KB
実行使用メモリ 14,148 KB
最終ジャッジ日時 2023-08-01 17:51:29
合計ジャッジ時間 17,716 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 334 ms
9,348 KB
testcase_25 AC 411 ms
10,976 KB
testcase_26 AC 195 ms
7,152 KB
testcase_27 AC 399 ms
10,760 KB
testcase_28 AC 215 ms
7,652 KB
testcase_29 AC 494 ms
12,044 KB
testcase_30 AC 210 ms
7,604 KB
testcase_31 AC 123 ms
5,996 KB
testcase_32 AC 534 ms
13,080 KB
testcase_33 AC 244 ms
8,332 KB
testcase_34 AC 351 ms
9,980 KB
testcase_35 AC 594 ms
13,896 KB
testcase_36 AC 51 ms
4,696 KB
testcase_37 AC 142 ms
6,356 KB
testcase_38 AC 485 ms
12,048 KB
testcase_39 AC 347 ms
9,732 KB
testcase_40 AC 447 ms
11,728 KB
testcase_41 AC 28 ms
4,376 KB
testcase_42 AC 525 ms
12,852 KB
testcase_43 AC 475 ms
11,956 KB
testcase_44 AC 589 ms
13,940 KB
testcase_45 AC 609 ms
13,900 KB
testcase_46 AC 601 ms
13,856 KB
testcase_47 AC 634 ms
13,804 KB
testcase_48 AC 615 ms
14,144 KB
testcase_49 AC 568 ms
13,876 KB
testcase_50 AC 597 ms
14,148 KB
testcase_51 AC 585 ms
13,988 KB
testcase_52 AC 598 ms
13,848 KB
testcase_53 AC 620 ms
13,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, D;
  cin>>N>>D;
  vector<int> arr(N);
  int A[N];
  for(int i=0;i<N;++i){
    cin>>A[i];
    arr[i] = A[i];
  }
  sort(arr.begin(), arr.end());
  map<int, int> amap;
  int index;
  for(int i=0;i<N;++i){
    index = upper_bound(arr.begin(), arr.end(), A[i]-D)-arr.begin();
    amap[A[i]] = index;
  }
  for(int i=0;i<N;++i){
    cout<<amap[A[i]]<<endl;
  }
}

0