結果

問題 No.1110 好きな歌
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-11 00:16:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 397 ms / 5,000 ms
コード長 870 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 105,524 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 01:47:34
合計ジャッジ時間 12,510 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,948 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 3 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 3 ms
6,944 KB
testcase_17 AC 4 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 224 ms
6,944 KB
testcase_25 AC 264 ms
6,940 KB
testcase_26 AC 140 ms
6,940 KB
testcase_27 AC 268 ms
6,944 KB
testcase_28 AC 157 ms
6,944 KB
testcase_29 AC 306 ms
6,944 KB
testcase_30 AC 154 ms
6,940 KB
testcase_31 AC 91 ms
6,940 KB
testcase_32 AC 374 ms
6,944 KB
testcase_33 AC 168 ms
6,944 KB
testcase_34 AC 248 ms
6,944 KB
testcase_35 AC 378 ms
6,944 KB
testcase_36 AC 43 ms
6,944 KB
testcase_37 AC 109 ms
6,944 KB
testcase_38 AC 321 ms
6,940 KB
testcase_39 AC 242 ms
6,940 KB
testcase_40 AC 293 ms
6,940 KB
testcase_41 AC 25 ms
6,944 KB
testcase_42 AC 337 ms
6,940 KB
testcase_43 AC 307 ms
6,944 KB
testcase_44 AC 370 ms
6,940 KB
testcase_45 AC 389 ms
6,940 KB
testcase_46 AC 377 ms
6,940 KB
testcase_47 AC 384 ms
6,940 KB
testcase_48 AC 382 ms
6,940 KB
testcase_49 AC 359 ms
6,940 KB
testcase_50 AC 381 ms
6,940 KB
testcase_51 AC 383 ms
6,940 KB
testcase_52 AC 380 ms
6,944 KB
testcase_53 AC 397 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
const int inf = (int)1e9;

ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 
 
 map<int,int>mp;
 
 
 
int main(void){
	ll n,d;
	cin>>n>>d;
	vector<int>a(n),A(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		A[i]=a[i];
	}
	//cout<<a.end()-a.begin()<<endl;
	sort(A.begin(),A.end());
	for(int i=0;i<n;i++){
		ll index = upper_bound(A.begin(),A.end(),a[i]-d)-A.begin();
		cout<<index<<endl;
	}
    return 0;
}
0