結果
問題 |
No.1110 好きな歌
|
ユーザー |
|
提出日時 | 2020-07-11 16:22:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 372 ms / 5,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 1,891 ms |
コンパイル使用メモリ | 176,536 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-10-13 04:46:02 |
合計ジャッジ時間 | 12,719 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll = long long; using P = pair<int,int>; int main(){ int n,d; cin>>n>>d; vector<P>p(n); vector<int>a(n),ans(n); rep(i,n){ cin>>a[i]; p[i]=P(a[i],i); } sort(a.begin(),a.end()); sort(p.begin(),p.end()); rep(i,n){ ans[p[i].second]=(lower_bound(a.begin(),a.end(),p[i].first-d+1)-a.begin()); } rep(i,n)cout<<ans[i]<<endl; }