結果
問題 |
No.1093 区間の和 / Sum of Range
|
ユーザー |
👑 |
提出日時 | 2023-02-03 00:59:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 949 ms |
コンパイル使用メモリ | 84,608 KB |
最終ジャッジ日時 | 2025-02-10 08:21:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 36 |
ソースコード
#include <iostream> #include <queue> #include <algorithm> using namespace std; int main(){ int n,k;cin>>n>>k; long long sm = 0; queue<long long> A; for(int i = 0; k > i; i++){ long long x;cin>>x; A.push(x); sm += x; } vector<long long> B; B.push_back(sm); for(int i = 0; n-k > i; i++){ long long x;cin>>x; sm += x;A.push(x); sm -= A.front(); A.pop(); B.push_back(sm); } sort(B.begin(),B.end()); for(int i = 0; B.size() > i; i++)cout << B[i] << " "; cout << endl; int q;cin>>q; for(int i = 0; q > i; i++){ long long x;cin>>x; auto z = upper_bound(B.begin(),B.end(),x); cout << z-B.begin() << endl; } }