#include <bits/stdc++.h>
#define int long long
#define Kuanyshh ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;
#define F first
#define S second
#pragma GCC optimize( "Ofast", "O3" , "unroll-loops")
#pragma GCC target ("sse,sse2")
using namespace std;
const int N = 1e6+77;
const int inf = 1e18+77;
const double eps = 1e-11;
vector<pair<int, int>> g[N];
void solve(){
int n;
cin >> n;
int sum = 0;
for(int i = 1; i <= n - 1; i++){
int a, b, w;
cin >> a >> b >> w;
sum += w;
g[a].push_back({b,w});
}
int q;
cin >> q;
while(q--){
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
cout << sum;
}
}
signed main(){
Kuanyshh;
int tt = 1;
// cin >> tt;
while(tt--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
25328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
25164 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23764 KB |
Output is correct |
2 |
Incorrect |
25 ms |
25328 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |