| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1352610 | afterzero | Race (IOI11_race) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std ;
int main(){
int n , k ;
cin >> n >> k ;
vector<pair<int,int>>h(n-1);
for(int i = 0 ; i< n -1; i++){
cin >> h[i].first >> h[i].second;
}
vector<int>l(n-1);
int sum = 0 ;
for(int i = 0 ; i< n-1 ; i++){
cin >> l[i];
sum+=l[i];
}
if(sum==k){
cout << n << endl;
}else{
cout << -1 << endl;
}
}
