結果
問題 | No.1110 好きな歌 |
ユーザー |
![]() |
提出日時 | 2020-07-10 21:47:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 543 ms / 5,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 2,859 ms |
コンパイル使用メモリ | 197,576 KB |
最終ジャッジ日時 | 2025-01-11 18:16:33 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair<int,int> P; int main() { int n, d; cin >> n >> d; vector<int> a(n); rep(i,n) cin >> a[i]; auto b = a; sort(b.begin(), b.end()); for (int i = 0; i < n; i++) { int x = a[i] - d; auto itr = upper_bound(b.begin(), b.end(), x) - b.begin(); cout << itr << endl; } return 0; }