# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625676 | 2022-08-10T16:51:34 Z | GordonRemzi007 | Addk (eJOI21_addk) | C++17 | 2000 ms | 596 KB |
//addk #include <iostream> #include <vector> #include <string> using namespace std; int main() { int n, k, q; int l, r, m; int res; vector<int> a, temp; string result; cin >> n; cin >> k; for (int i = 0; i < n; i++) { cin >> q; a.push_back(q); } cin >> q; for (int i = 0; i < q; i++) { res = 0; temp.clear(); cin >> n; if (n == 1) { for (int i = 0; i < k; i++) { cin >> n; temp.push_back(n); } for (int i = 0; i < temp.size(); i++) { if (i + 1 == temp.size()) { a[temp[i] - 1] = a[temp[0] - 1]; break; } a[temp[i] - 1] = a[temp[i + 1] - 1]; } } else { cin >> l; cin >> r; cin >> m; for (int i = 0; i < (r - l + 1 >= m ? r - l - m + 2 : 0); i++) { for (int j = 0; j < m; j++) res += a[l + i + j - 1]; } result.append(to_string(res).append("\n")); } } cout << result; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 49 ms | 340 KB | Output is correct |
3 | Incorrect | 345 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2072 ms | 400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2073 ms | 596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |