結果

問題 No.1110 好きな歌
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-07-11 00:16:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 371 ms / 5,000 ms
コード長 870 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 104,564 KB
実行使用メモリ 4,904 KB
最終ジャッジ日時 2023-08-02 01:04:12
合計ジャッジ時間 12,594 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 209 ms
4,380 KB
testcase_25 AC 253 ms
4,376 KB
testcase_26 AC 130 ms
4,376 KB
testcase_27 AC 252 ms
4,376 KB
testcase_28 AC 143 ms
4,380 KB
testcase_29 AC 305 ms
4,392 KB
testcase_30 AC 141 ms
4,380 KB
testcase_31 AC 88 ms
4,376 KB
testcase_32 AC 327 ms
4,376 KB
testcase_33 AC 165 ms
4,376 KB
testcase_34 AC 222 ms
4,376 KB
testcase_35 AC 334 ms
4,632 KB
testcase_36 AC 37 ms
4,376 KB
testcase_37 AC 101 ms
4,376 KB
testcase_38 AC 301 ms
4,392 KB
testcase_39 AC 221 ms
4,380 KB
testcase_40 AC 270 ms
4,376 KB
testcase_41 AC 22 ms
4,380 KB
testcase_42 AC 316 ms
4,380 KB
testcase_43 AC 295 ms
4,380 KB
testcase_44 AC 345 ms
4,904 KB
testcase_45 AC 347 ms
4,632 KB
testcase_46 AC 351 ms
4,624 KB
testcase_47 AC 371 ms
4,568 KB
testcase_48 AC 344 ms
4,636 KB
testcase_49 AC 321 ms
4,608 KB
testcase_50 AC 341 ms
4,572 KB
testcase_51 AC 341 ms
4,580 KB
testcase_52 AC 351 ms
4,748 KB
testcase_53 AC 365 ms
4,660 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