結果

問題 No.1110 好きな歌
ユーザー mmn15277198mmn15277198
提出日時 2020-07-11 14:18:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 325 ms / 5,000 ms
コード長 922 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 101,872 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-08-03 03:28:08
合計ジャッジ時間 11,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 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 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 2 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,376 KB
testcase_24 AC 181 ms
4,380 KB
testcase_25 AC 224 ms
4,376 KB
testcase_26 AC 116 ms
4,380 KB
testcase_27 AC 228 ms
4,380 KB
testcase_28 AC 125 ms
4,380 KB
testcase_29 AC 269 ms
4,376 KB
testcase_30 AC 125 ms
4,376 KB
testcase_31 AC 76 ms
4,376 KB
testcase_32 AC 301 ms
4,692 KB
testcase_33 AC 139 ms
4,380 KB
testcase_34 AC 195 ms
4,376 KB
testcase_35 AC 296 ms
4,620 KB
testcase_36 AC 32 ms
4,376 KB
testcase_37 AC 88 ms
4,380 KB
testcase_38 AC 265 ms
4,376 KB
testcase_39 AC 194 ms
4,376 KB
testcase_40 AC 236 ms
4,428 KB
testcase_41 AC 19 ms
4,376 KB
testcase_42 AC 270 ms
4,380 KB
testcase_43 AC 258 ms
4,380 KB
testcase_44 AC 306 ms
4,688 KB
testcase_45 AC 308 ms
4,616 KB
testcase_46 AC 310 ms
4,636 KB
testcase_47 AC 324 ms
4,568 KB
testcase_48 AC 317 ms
4,776 KB
testcase_49 AC 287 ms
4,620 KB
testcase_50 AC 308 ms
4,572 KB
testcase_51 AC 310 ms
4,692 KB
testcase_52 AC 312 ms
4,684 KB
testcase_53 AC 325 ms
4,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INFL = 1e17+7;
const long long INFI = 1e9+7;
const long long MOD = 1e9+7;
const double EXP = 1e-8;
const double PI=acos(-1);

using namespace std;

int nibuntansaku(vector<int> &v,int target){
	int start=0;
	int end=v.size()-1;
	int id=0;
	int mid;
	while(1){
		mid=(end+start)/2;
		if(v[mid]>target){
			end=mid;	
		}else if(v[mid]<=target){
			start=mid;
		}
		if(end-start<=1){
			return start;
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,d;
	cin >> n >> d;
	vector<int> a(n+1);
	vector<int> b(n+1);
	a[0]=b[0]=0;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		b[i]=a[i];
	}
	sort(b.begin(),b.end());
	for(int i=1;i<a.size();i++){
		cout << nibuntansaku(b,a[i]-d) << endl;
	}
	return 0;
}

0