| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1333838 | YSH2020 | Wind Turbines (EGOI25_windturbines) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n,m; cin >> n >> m;
int q; cin >> q;
int x[n-1]; for (int i = 0; i < n-1; i++) {
int a,b,c; cin >> a >> b >> c;
x[i]=c;
}
int pref[n]; pref[0]=0;
for (int i = 1; i < n; i++) pref[i]=pref[i-1]+x[i-1];
while (q--) {
int s,e; cin >> s >> e;
cout << pref[n-1]-(pref[e-1]-pref[s]) << newl;
}
}