結果
問題 |
No.1093 区間の和 / Sum of Range
|
ユーザー |
|
提出日時 | 2020-06-24 07:36:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 193 ms / 2,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 69,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 19:56:04 |
合計ジャッジ時間 | 5,584 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 36 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N,K; int A[1<<17]; main() { cin>>N>>K; int S=0; for(int i=0;i<N;i++) { cin>>A[i]; S+=A[i]; if(i+1>=K) { int T=A[i+1-K]; A[i+1-K]=S; S-=T; } } sort(A,A+N-K+1); int Q;cin>>Q; for(;Q--;) { int x;cin>>x; cout<<upper_bound(A,A+N-K+1,x)-A<<endl; } }