結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-12 16:37:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 364 ms / 5,000 ms |
| コード長 | 707 bytes |
| コンパイル時間 | 833 ms |
| コンパイル使用メモリ | 78,652 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 14:05:44 |
| 合計ジャッジ時間 | 12,846 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int main() {
int n, d;
cin >> n >> d;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<int> b = a;
sort(b.begin(), b.end());
for (int i = 0; i < n; ++i) {
int ok = -1, ng = n;
while (1 < abs(ok - ng)) {
int mid = (ok + ng) / 2;
if (b[mid] <= a[i] - d) {
ok = mid;
} else {
ng = mid;
}
}
cout << ok + 1 << endl;
}
return 0;
}