fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool pass (long long n, long long k, unsigned long long& H) {
  5. unsigned long long tmp= pow(2, n-1);
  6. if (H<tmp) return 0;
  7. H=H-tmp+k;
  8. return 1;
  9. }
  10.  
  11. bool solve (int t, unsigned long long& H) {
  12. while (t--) {
  13. long long n, k; cin >> n >> k;
  14. if (!pass(n, k, H)) return 0;
  15. }
  16. return 1;
  17. }
  18.  
  19. int main () {
  20. int t;
  21. unsigned long long H;
  22. cin >> t >> H;
  23. if (solve(t, H)) cout << "hehe";
  24. else cout << "huhu";
  25. }
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
hehe