結果

問題 No.1110 好きな歌
ユーザー chocoruskchocorusk
提出日時 2020-07-10 21:30:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 371 ms / 5,000 ms
コード長 1,006 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 134,028 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-04-19 15:46:42
合計ジャッジ時間 11,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 4 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 201 ms
7,168 KB
testcase_25 AC 252 ms
7,808 KB
testcase_26 AC 131 ms
5,760 KB
testcase_27 AC 249 ms
7,680 KB
testcase_28 AC 142 ms
6,016 KB
testcase_29 AC 292 ms
8,320 KB
testcase_30 AC 142 ms
5,888 KB
testcase_31 AC 90 ms
5,376 KB
testcase_32 AC 321 ms
8,960 KB
testcase_33 AC 159 ms
6,400 KB
testcase_34 AC 217 ms
7,296 KB
testcase_35 AC 345 ms
9,432 KB
testcase_36 AC 38 ms
5,376 KB
testcase_37 AC 93 ms
5,376 KB
testcase_38 AC 302 ms
8,448 KB
testcase_39 AC 210 ms
7,040 KB
testcase_40 AC 270 ms
8,320 KB
testcase_41 AC 22 ms
5,376 KB
testcase_42 AC 301 ms
8,832 KB
testcase_43 AC 281 ms
8,448 KB
testcase_44 AC 356 ms
9,600 KB
testcase_45 AC 345 ms
9,728 KB
testcase_46 AC 340 ms
9,580 KB
testcase_47 AC 340 ms
9,472 KB
testcase_48 AC 340 ms
9,728 KB
testcase_49 AC 329 ms
9,472 KB
testcase_50 AC 371 ms
9,472 KB
testcase_51 AC 343 ms
9,600 KB
testcase_52 AC 342 ms
9,600 KB
testcase_53 AC 344 ms
9,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    ll d; cin>>d;
    ll a[200020];
    vector<pair<ll, int>> v(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
        v[i]=make_pair(a[i], i);
    }
    sort(v.begin(), v.end());
    ll ans[200020];
    for(int i=0; i<n; i++){
        int k=lower_bound(v.begin(), v.end(), make_pair(v[i].first-d+1, -1))-v.begin();
        ans[v[i].second]=k;
    }
    for(int i=0; i<n; i++) cout<<ans[i]<<endl;
    return 0;
}
0