結果

問題 No.1093 区間の和 / Sum of Range
ユーザー karinohitokarinohito
提出日時 2023-03-23 08:30:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 2,800 ms
コンパイル使用メモリ 207,212 KB
実行使用メモリ 4,896 KB
最終ジャッジ日時 2023-10-18 19:22:36
合計ジャッジ時間 12,411 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 105 ms
4,348 KB
testcase_02 AC 50 ms
4,348 KB
testcase_03 AC 32 ms
4,632 KB
testcase_04 AC 30 ms
4,368 KB
testcase_05 AC 155 ms
4,348 KB
testcase_06 AC 34 ms
4,348 KB
testcase_07 AC 87 ms
4,348 KB
testcase_08 AC 76 ms
4,368 KB
testcase_09 AC 137 ms
4,348 KB
testcase_10 AC 79 ms
4,348 KB
testcase_11 AC 130 ms
4,348 KB
testcase_12 AC 79 ms
4,368 KB
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 140 ms
4,348 KB
testcase_15 AC 37 ms
4,348 KB
testcase_16 AC 165 ms
4,348 KB
testcase_17 AC 139 ms
4,348 KB
testcase_18 AC 92 ms
4,348 KB
testcase_19 AC 11 ms
4,348 KB
testcase_20 AC 75 ms
4,348 KB
testcase_21 AC 248 ms
4,348 KB
testcase_22 AC 305 ms
4,348 KB
testcase_23 AC 234 ms
4,348 KB
testcase_24 AC 75 ms
4,348 KB
testcase_25 AC 278 ms
4,348 KB
testcase_26 AC 123 ms
4,368 KB
testcase_27 AC 157 ms
4,348 KB
testcase_28 AC 140 ms
4,368 KB
testcase_29 AC 415 ms
4,896 KB
testcase_30 AC 51 ms
4,348 KB
testcase_31 AC 67 ms
4,348 KB
testcase_32 AC 108 ms
4,348 KB
testcase_33 AC 329 ms
4,348 KB
testcase_34 AC 23 ms
4,348 KB
testcase_35 AC 333 ms
4,348 KB
testcase_36 AC 265 ms
4,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
int main() {
    ll N,K,Q;
   cin>>N>>K;
   vll A(N+1,0),P(N-K+1);
   rep(i,N)cin>>A[i+1],A[i+1]+=A[i];
    rep(i,N-K+1)P[i]=A[i+K]-A[i];
    sort(all(P));
    cin>>Q;
    while(cin>>Q)cout<<upper_bound(all(P),Q)-P.begin()<<endl;
}

0