제출 #1071371

#제출 시각아이디문제언어결과실행 시간메모리
1071371vjudge1Addk (eJOI21_addk)C++17
36 / 100
2033 ms2240 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); pref[0] = 0; 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 ans = 0; if (m == 1) { cout << pref[r] - pref[l - 1] << '\n'; continue; } int tl = l-1, tr = l + m - 1; while (tr <= r) ans += pref[tr++] - pref[tl++]; cout << ans << '\n'; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:24:2: warning: statement has no effect [-Wunused-value]
   24 |  q; cin >> q;
      |  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...