# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
767336 | 2023-06-26T15:59:54 Z | ivopav | Addk (eJOI21_addk) | C++17 | 195 ms | 6704 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"; // cout << "a\n"; long long int m; cin >> m; for (long long int i=0;i<m;i++){ long long int vrs; cin >> vrs; if (vrs==2){ long long int l; long long int r; long long int m; cin >> l >> r >> m; m=min(m,(r-l+1)-m+1); // cout << m << "\n"; cout << (prefpref[r+1]-prefpref[r-m+1])-(prefpref[l+m-1]-prefpref[l-1]) << "\n"; } else { int unos; cin >> unos; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 2 ms | 316 KB | Output is correct |
3 | Correct | 4 ms | 340 KB | Output is correct |
4 | Correct | 6 ms | 436 KB | Output is correct |
5 | Correct | 12 ms | 440 KB | Output is correct |
6 | Correct | 10 ms | 632 KB | Output is correct |
7 | Correct | 12 ms | 732 KB | Output is correct |
8 | Correct | 18 ms | 724 KB | Output is correct |
9 | Correct | 23 ms | 1300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 1236 KB | Output is correct |
2 | Correct | 58 ms | 2188 KB | Output is correct |
3 | Correct | 79 ms | 2892 KB | Output is correct |
4 | Correct | 135 ms | 4832 KB | Output is correct |
5 | Correct | 195 ms | 6704 KB | Output is correct |
6 | Correct | 180 ms | 6400 KB | Output is correct |
7 | Correct | 181 ms | 6472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 1744 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |