제출 #1115172

#제출 시각아이디문제언어결과실행 시간메모리
1115172staszic_ojuzFire (JOI20_ho_t5)C++17
1 / 100
228 ms262144 KiB
#include<bits/stdc++.h> using namespace std; using i64 = int64_t; vector<vector<i64>> pre; int main() { ios_base::sync_with_stdio(0); cin.tie(0); i64 N, Q; cin >> N >> Q; vector<i64> district(N); for (i64 i = 0; i < N; i++) { cin >> district[i]; } pre.resize(N + 1); pre[0] = district; for (i64 i = 1; i <= N; i++) { pre[i].resize(N); for (i64 k = 0; k < N; k++) { pre[i][k] = pre[i - 1][k]; if (k > 0) pre[i][k] = max(pre[i - 1][k - 1], pre[i][k]); } } for (i64 i = 0; i < Q; i++) { i64 t, r, l, suma = 0; cin >> t >> r >> l; for (i64 k = r - 1; k < l; k++) { //cout << k << " : " << pre[t][k] << "\n"; suma += pre[t][k]; } cout << suma << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...