#include <bits/stdc++.h>
#define ibase ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define ff first
#define int long long
#define ss second
using namespace std;
const int N = 1e3 + 3;
const int MOD = 1e9 + 7;
vector < pair < int, int > > g[N];
void solve(){
int n, sum = 0;
cin >> n;
for(int i=1; i<n; i++){
int x, y, cost;
sum += cost;
cin >> x >> y >> cost;
g[x].pb(make_pair(y, cost));
}
int q;
cin >> q;
while(q--){
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
cout << sum << endl;
}
}
signed main() {
ibase;
int t = 1;
//freopen("floor4.in", "r", stdin);
//freopen("floor4.out", "w", stdout);
//cin >> t;
while (t--) {
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
472 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
724 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |