結果

問題 No.1110 好きな歌
ユーザー mkmkmkmkmkmkmkmk
提出日時 2020-07-10 23:46:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 383 ms / 5,000 ms
コード長 1,898 bytes
コンパイル時間 1,654 ms
コンパイル使用メモリ 170,932 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 00:55:17
合計ジャッジ時間 12,396 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
6,948 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 3 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 3 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 219 ms
6,940 KB
testcase_25 AC 259 ms
6,940 KB
testcase_26 AC 136 ms
6,940 KB
testcase_27 AC 265 ms
6,944 KB
testcase_28 AC 154 ms
6,944 KB
testcase_29 AC 309 ms
6,944 KB
testcase_30 AC 143 ms
6,944 KB
testcase_31 AC 90 ms
6,944 KB
testcase_32 AC 335 ms
6,940 KB
testcase_33 AC 164 ms
6,944 KB
testcase_34 AC 226 ms
6,940 KB
testcase_35 AC 343 ms
6,940 KB
testcase_36 AC 36 ms
6,944 KB
testcase_37 AC 99 ms
6,940 KB
testcase_38 AC 315 ms
6,944 KB
testcase_39 AC 228 ms
6,940 KB
testcase_40 AC 273 ms
6,948 KB
testcase_41 AC 23 ms
6,944 KB
testcase_42 AC 318 ms
6,944 KB
testcase_43 AC 311 ms
6,940 KB
testcase_44 AC 356 ms
6,940 KB
testcase_45 AC 365 ms
6,940 KB
testcase_46 AC 365 ms
6,944 KB
testcase_47 AC 383 ms
6,940 KB
testcase_48 AC 363 ms
6,940 KB
testcase_49 AC 338 ms
6,944 KB
testcase_50 AC 377 ms
6,940 KB
testcase_51 AC 355 ms
6,940 KB
testcase_52 AC 363 ms
6,944 KB
testcase_53 AC 371 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    
 
 
  int main(){
      lint n,d;
      cin>>n>>d;
      vector<lint> a(n);
     vector<lint> b(n);
      rep(i,n){
          cin>>a[i];
          b[i]=a[i];
      }
      sort(all(b));
      rep(i,n){
          auto it=upper_bound(all(b),a[i]-d);
          lint ans=it-b.begin();
          cout<<ans<<endl;
      }
     }
     
 
0