結果
| 問題 | No.1110 好きな歌 |
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2019-10-24 23:36:32 |
| 言語 | C++17(clang) (17.0.6 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 645 bytes |
| 記録 | |
| コンパイル時間 | 1,960 ms |
| コンパイル使用メモリ | 163,964 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-11-30 15:29:29 |
| 合計ジャッジ時間 | 7,057 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 10 WA * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, d;
cin >> n >> d;
array<pair<int, int>, 200000> p;
for (int i = 0; i < n; i++) {
int a_i;
cin >> a_i;
p[i] = make_pair(a_i, i);
}
sort(p.begin(), p.begin() + n);
array<int, 200000> a, ans;
int index = 0;
for (int i = 0; i < n; i++) a[i] = p[i].first;
for (int i = 0; i < n; i++) {
index = upper_bound(a.begin() + index, a.begin() + n, a[i] - d) - a.begin();
ans[p[i].second] = index;
}
for (int x : ans) {
cout << x << "\n";
}
}
trineutron