結果
問題 |
No.1110 好きな歌
|
ユーザー |
![]() |
提出日時 | 2020-07-10 21:55:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 391 ms / 5,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 1,795 ms |
コンパイル使用メモリ | 173,996 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-11 09:01:00 |
合計ジャッジ時間 | 12,434 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define repr(i,n) for(int i = (int)(n); i >= 0; i--) #define all(v) v.begin(),v.end() typedef long long ll; int main(){ ll N,D; cin >> N >> D; vector<ll> vec(N); rep(i,N){ cin >> vec[i]; } vector<ll> vec_copy(N); rep(i,N){ vec_copy[i] = vec[i]; } sort(all(vec_copy)); rep(i,N){ if (vec[i] - D < vec_copy[0]){ cout << 0 << endl; } else{ vector<ll>::iterator itr = upper_bound(all(vec_copy), vec[i] - D); cout << itr - vec_copy.begin() << endl; } } }