結果

問題 No.1110 好きな歌
ユーザー NeccoliniNeccolini
提出日時 2020-09-30 23:31:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 399 ms / 5,000 ms
コード長 2,129 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 171,336 KB
実行使用メモリ 6,452 KB
最終ジャッジ日時 2023-09-20 19:29:36
合計ジャッジ時間 17,233 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 4 ms
4,380 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 225 ms
4,924 KB
testcase_25 AC 271 ms
5,104 KB
testcase_26 AC 140 ms
4,380 KB
testcase_27 AC 269 ms
5,200 KB
testcase_28 AC 154 ms
4,376 KB
testcase_29 AC 322 ms
5,628 KB
testcase_30 AC 151 ms
4,376 KB
testcase_31 AC 94 ms
4,376 KB
testcase_32 AC 353 ms
5,948 KB
testcase_33 AC 173 ms
4,680 KB
testcase_34 AC 237 ms
5,152 KB
testcase_35 AC 365 ms
6,156 KB
testcase_36 AC 40 ms
4,380 KB
testcase_37 AC 107 ms
4,380 KB
testcase_38 AC 319 ms
5,784 KB
testcase_39 AC 234 ms
4,884 KB
testcase_40 AC 281 ms
5,372 KB
testcase_41 AC 24 ms
4,376 KB
testcase_42 AC 335 ms
5,948 KB
testcase_43 AC 318 ms
5,924 KB
testcase_44 AC 370 ms
6,328 KB
testcase_45 AC 384 ms
6,452 KB
testcase_46 AC 381 ms
6,160 KB
testcase_47 AC 399 ms
6,244 KB
testcase_48 AC 383 ms
6,272 KB
testcase_49 AC 356 ms
6,272 KB
testcase_50 AC 380 ms
6,256 KB
testcase_51 AC 376 ms
6,316 KB
testcase_52 AC 376 ms
6,308 KB
testcase_53 AC 395 ms
6,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<int,int>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
const int MOD = 1000000007;
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;
x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int n,d;
VI a;
int main(){
   cin>>n>>d;
   a.resize(n);
   rep(i,n)cin>>a[i];
   VI a_sorted=a;
   sort(ALL(a_sorted));
   rep(i,n){
      int x=a[i]-d;
      auto iter=upper_bound(ALL(a_sorted),x);
      int idx=distance(a_sorted.begin(),iter);
      cout<<idx<<endl;
   }
}
0