結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 21:44:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,067 ms / 5,000 ms |
| コード長 | 553 bytes |
| コンパイル時間 | 3,090 ms |
| コンパイル使用メモリ | 206,460 KB |
| 最終ジャッジ日時 | 2025-01-11 18:14:06 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
int main() {
ll n,d;
std::cin >> n>>d;
vector<ll> a(n);
map<ll,ll> vi,iv;
for (int i = 0; i < n; i++) {
std::cin >> a[i];
vi[a[i]] = i;
iv[i] = a[i];
}
sort(a.begin(),a.end());
map<ll,ll> ans;
for (int i = 0; i < n; i++) {
ans[a[i]] = distance(a.begin(),upper_bound(a.begin(),a.end(),a[i]-d));
}
for (int i = 0; i < n; i++) {
std::cout << ans[iv[i]] << std::endl;
}
}