# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1071665 |
2024-08-23T09:47:37 Z |
vjudge1 |
Addk (eJOI21_addk) |
C++17 |
|
2000 ms |
1748 KB |
#include <bits/stdc++.h>
#define int long long
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
const int N=1e5+1;
const int inf=1e18;
const int mod=1e9+7;
using namespace std;
vector<int>v;
signed main(){
boost;
int n,k;
cin>>n>>k;
v.push_back(0);
for(int i=1;i<=n;i++){
int x;
cin>>x;
v.push_back(x);
}
int q;
cin>>q;
while(q--){
int type;
cin>>type;
if(type==1){
for(int i=1;i<=k;i++){
int x;
cin>>x;
}
}else{
int l,r,m;
cin>>l>>r>>m;
int ans=0;
int cnt=1;
int pos=r-m+1;
int pos1=l+m-1;
int l1=min(pos,pos1);
int r1=max(pos,pos1);
for(int i=l;i<=r;i++){
ans+=v[i]*cnt;
if(l1<=i&&i<r1){
continue;
}
if(i>=r1){
cnt--;
continue;
}
cnt=min(cnt+1,m);
}
cout<<ans<<"\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
348 KB |
Output is correct |
4 |
Correct |
7 ms |
344 KB |
Output is correct |
5 |
Correct |
18 ms |
344 KB |
Output is correct |
6 |
Correct |
18 ms |
604 KB |
Output is correct |
7 |
Correct |
24 ms |
640 KB |
Output is correct |
8 |
Correct |
34 ms |
624 KB |
Output is correct |
9 |
Correct |
63 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
283 ms |
980 KB |
Output is correct |
2 |
Correct |
564 ms |
1116 KB |
Output is correct |
3 |
Correct |
1032 ms |
1236 KB |
Output is correct |
4 |
Execution timed out |
2082 ms |
1748 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1032 ms |
1348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |