# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
767289 | 2023-06-26T15:07:06 Z | ivopav | Addk (eJOI21_addk) | C++17 | 102 ms | 2224 KB |
#include <bits/stdc++.h> using namespace std; int main(){ long long int n; long long int k; cin >> n >> k; vector<long long int> lis={}; for (long long int i=0;i<n;i++){ long long int unos; cin >> unos; lis.push_back(unos); } vector<long long int> pref={0}; for (long long int i=0;i<n;i++){ pref.push_back(pref.back()+lis[i]); } vector<long long int> prefpref={0 }; //cout << "0 "; for (long long int i=0;i<pref.size();i++){ prefpref.push_back(prefpref.back()+pref[i]); //cout << prefpref.back() << " "; } // cout << "\n"; long long int m; cin >> m; for (long long int i=0;i<m;i++){ long long int vrs; long long int l; long long int r; long long int m; cin >> vrs >> l >> r >> m; m=min(m,(r-l+2)/2); cout << (prefpref[r+1]-prefpref[r-m+1])-(prefpref[l+m-1]-prefpref[l-1]) << "\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 1112 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 102 ms | 2224 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |