結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-10 22:49:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,288 bytes |
| コンパイル時間 | 1,153 ms |
| コンパイル使用メモリ | 97,812 KB |
| 実行使用メモリ | 696,616 KB |
| 最終ジャッジ日時 | 2024-10-11 10:08:41 |
| 合計ジャッジ時間 | 8,440 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 MLE * 1 -- * 41 |
ソースコード
#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;
for(int i = 0; i < n; i++){
cin >> a[i];
num[a[i]]++;
}
// for(int i = 0; i < n; i++){
// cout << num[i] << " ";
// }
// cout << endl;
vector<int> b(n);
b = a;
sort(a.begin(), a.end());
int tmp= -1;
int pre;
for(int i = 0; i<n; i++){
if(tmp == a[i]) continue;
if(i != 0){
for(int j = 1; j < a[i]-tmp; j++){
num[j+tmp] = num[tmp];
}
}
tmp = a[i];
if(i != 0){
pre = a[i-1];
//cout << "num[a[i]]: " << num[a[i]] << endl;
num[a[i]] += num[pre];
//cout << num[a[i]] << endl;
}
}
// for(int i = 0; i <= a[n-1]; i++){
// cout << "i: " << i << endl;
// cout << "num: " << num[i] << endl;
// }
for(int i = 0; i < n; i++){
if(b[i] - d >= 0){
cout << num[b[i]-d] << endl;
}else{
cout << 0 << endl;
}
}
return 0;
}