Submission #1071722

#TimeUsernameProblemLanguageResultExecution timeMemory
1071722vjudge1Addk (eJOI21_addk)C++17
0 / 100
101 ms1624 KiB
#include <iostream> #include <vector> using namespace std; using ll = long long int; const int N = 100002; ll n, K; int a[N], q; short int op; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> K; for (int i = 1; i <= n; ++i) cin >> a[i]; vector<ll> pref(n+1); for (int i = 1; i <= n; ++i) pref[i] = pref[i - 1] + a[i]; q; cin >> q; for (int tc = 1; tc <= q; ++tc) { cin >> op; if (op == 1) { int x; cin >> x; continue; } else { int l, r, m; cin >> l >> r >> m; ll sum = 0; while (l + m - 2 < r) sum += pref[l + m - 2] - pref[l++ - 1]; cout << sum << '\n'; } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:23:2: warning: statement has no effect [-Wunused-value]
   23 |  q; cin >> q;
      |  ^
Main.cpp:36:36: warning: operation on 'l' may be undefined [-Wsequence-point]
   36 |     sum += pref[l + m - 2] - pref[l++ - 1];
      |                                   ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...