Guest User

combine.cpp

a guest
Nov 12th, 2025
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. pair <int, pair <int, int> > combine(int v){
  6.     pair <int, pair <int, int> > val;
  7.  
  8.     val.first = t[v << 1].first + t[(v << 1) | 1].first;
  9.     int cnt = min(t[v << 1].second.first, t[(v << 1) | 1].second.second);
  10.     val.first += cnt * 2;
  11.     val.second.first = t[v << 1].second.first +
  12.                                     t[(v << 1) | 1].second.first - cnt;
  13.     val.second.second = t[v << 1].second.second +
  14.                                     t[(v << 1) | 1].second.second - cnt;
  15.     return val;
  16. }
  17.  
  18. int main() {
  19.  
  20.    
  21.  
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment