# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632034 | 2022-08-19T10:32:39 Z | Jovan26 | Addk (eJOI21_addk) | C++14 | 2000 ms | 4288 KB |
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; long long k; cin>>k; long long a[n]; for(long i=0;i<n;i++) cin>>a[i]; long long q; cin>>q; bool p = false; vector<long long> v; for(long long j=0;j<q;j++){ int x; cin>>x; if(x==1){ int y; cin>>y; continue; } long long l,r,m; p = true; cin>>l>>r>>m; long long ma = min(m,(r-l+1-m+1)); long long rez = 0; for(long long i=l-1;i<l+ma-2;i++){ rez+=(i-l+2)*a[i]; } for(long long i=r-1;i>r-ma;i--){ rez+=(r-i)*a[i]; } for(long long i=l+ma-2;i<=r-ma;i++){ rez+=a[i]*ma; } v.push_back(rez); } if(p){ for(long long i=0;i<v.size()-1;i++) cout<<v[i]<<endl; cout<<v[v.size()-1]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 3 ms | 212 KB | Output is correct |
3 | Correct | 6 ms | 352 KB | Output is correct |
4 | Correct | 11 ms | 340 KB | Output is correct |
5 | Correct | 16 ms | 340 KB | Output is correct |
6 | Correct | 25 ms | 384 KB | Output is correct |
7 | Correct | 29 ms | 572 KB | Output is correct |
8 | Correct | 35 ms | 676 KB | Output is correct |
9 | Correct | 61 ms | 896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 202 ms | 936 KB | Output is correct |
2 | Correct | 411 ms | 2000 KB | Output is correct |
3 | Correct | 709 ms | 2512 KB | Output is correct |
4 | Execution timed out | 2033 ms | 4288 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 14 ms | 1108 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |