結果
問題 |
No.1110 好きな歌
|
ユーザー |
|
提出日時 | 2020-07-10 22:25:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,084 bytes |
コンパイル時間 | 1,694 ms |
コンパイル使用メモリ | 166,412 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-11 09:41:25 |
合計ジャッジ時間 | 8,841 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 5 RE * 6 TLE * 1 -- * 39 |
ソースコード
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード //ループ #define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ #define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ //型名省略 typedef long long ll; //値 static const ll MX = 100005; static const ll MX_ll = 1e18; //ソート #define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0])) using namespace std; //#include "./lib/generic/search.h" int main(){ ll n, d; cin >> n >> d; ll a[n], amax=0; rep(i, n){ cin >> a[i]; amax = max(amax, a[i]); } ll b[amax], ans[amax]; //std::sort(a, a + SIZE_OF_ARRAY(a)); //rep(i, n) cout << a[i] << " "; ll cnt = 0; rep(i, n){ cnt = 0; if(b[a[i]]==1){ cout << ans[a[i]] << endl; } else{ rep(j, n){ //if(a[i]<a[j]) break; if(i!=j && a[i]-a[j]>=d) cnt++; } b[a[i]] = 1; ans[a[i]] = cnt; cout << cnt << endl; } } return 0; }