結果

問題 No.1110 好きな歌
ユーザー carrot46carrot46
提出日時 2020-07-10 21:36:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,841 ms / 5,000 ms
コード長 1,203 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 170,592 KB
実行使用メモリ 103,996 KB
最終ジャッジ日時 2024-04-19 16:09:38
合計ジャッジ時間 37,502 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 3 ms
6,940 KB
testcase_15 AC 3 ms
6,940 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 5 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 4 ms
6,940 KB
testcase_20 AC 4 ms
6,944 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 5 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 856 ms
56,980 KB
testcase_25 AC 1,215 ms
83,832 KB
testcase_26 AC 620 ms
46,652 KB
testcase_27 AC 1,220 ms
83,764 KB
testcase_28 AC 571 ms
43,004 KB
testcase_29 AC 1,551 ms
91,308 KB
testcase_30 AC 419 ms
31,596 KB
testcase_31 AC 286 ms
26,992 KB
testcase_32 AC 1,568 ms
93,764 KB
testcase_33 AC 516 ms
43,160 KB
testcase_34 AC 848 ms
54,236 KB
testcase_35 AC 1,307 ms
84,252 KB
testcase_36 AC 88 ms
12,960 KB
testcase_37 AC 488 ms
42,932 KB
testcase_38 AC 1,542 ms
91,032 KB
testcase_39 AC 1,186 ms
83,836 KB
testcase_40 AC 858 ms
53,576 KB
testcase_41 AC 68 ms
12,756 KB
testcase_42 AC 1,268 ms
84,128 KB
testcase_43 AC 1,470 ms
87,708 KB
testcase_44 AC 1,401 ms
84,212 KB
testcase_45 AC 1,643 ms
94,396 KB
testcase_46 AC 1,556 ms
89,664 KB
testcase_47 AC 1,841 ms
103,996 KB
testcase_48 AC 1,586 ms
92,352 KB
testcase_49 AC 1,018 ms
58,636 KB
testcase_50 AC 1,581 ms
92,092 KB
testcase_51 AC 1,505 ms
85,312 KB
testcase_52 AC 1,611 ms
93,120 KB
testcase_53 AC 1,816 ms
103,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);


int main() {
    class BIT{
            ll n;
      		unordered_map<ll, ll> bitree;
        public:
        	BIT(unsigned long _n){
              n = _n;
            }
        	void add(ll id, ll x){
              while(id <= n){
                bitree[id] += x;
                id += id & -id;
              }
              return;
            }
        	ll sum(ll id){
              ll temp = 0;
              while(id > 0){
                temp += bitree[id];
                id -= id & -id;
              }
              return temp;
            }
      };
    cin>>N>>K;
    vec a(N);
    rep(i,N) cin>>a[i];
    BIT bit(ll(1e+9) + 10);
    rep(i,N) bit.add(a[i], 1);
    rep(i,N) cout<<bit.sum(a[i] - K)<<endl;
}
0