結果
| 問題 | No.1110 好きな歌 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 23:02:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 856 bytes |
| 記録 | |
| コンパイル時間 | 1,020 ms |
| コンパイル使用メモリ | 93,772 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-11 16:45:37 |
| 合計ジャッジ時間 | 8,221 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 TLE * 1 -- * 49 |
ソースコード
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
using namespace std;
using ll = long long;
int main()
{
int n, d;
cin >> n >> d;
vector<int> a(n);
map<int, ll> num;
int mx = 0;
for(int i = 0; i < n; i++){
cin >> a[i];
num[a[i]]++;
mx = max(mx, a[i]);
}
bool ok = false;
for(int i = 0; i <= mx; i++){
if(num[i] != 0 && !ok){
ok = true;
}else if(num[i] == 0 && ok){
num[i] = num[i-1];
}else if(num[i] != 0 && ok){
num[i] += num[i-1];
}
}
for(int i = 0; i < n; i++){
if(a[i] -d >= 0){
cout << num[a[i]-d] << endl;
}else{
cout << 0 << endl;
}
}
return 0;
}