結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
IKyopro
|
| 提出日時 | 2020-07-10 21:30:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 5,000 ms |
| コード長 | 605 bytes |
| コンパイル時間 | 2,994 ms |
| コンパイル使用メモリ | 201,980 KB |
| 最終ジャッジ日時 | 2025-01-11 17:56:47 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
using P = pair<int,int>;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N,D;
cin >> N >> D;
vec<P> A(N);
for(int i=0;i<N;i++){
int a;
cin >> a;
A[i] = {a,i};
}
sort(A.rbegin(),A.rend());
vec<int> ans(N);
int r = 0;
for(int l=0;l<N;l++){
while(r<N && A[l].first-A[r].first<D) r++;
ans[A[l].second] = N-r;
}
for(auto& x:ans) cout << x << "\n";
}
IKyopro