fork(10) download
  1. #include<cstdio>
  2. #include<algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n; scanf("%d", &n);
  7. int p = 0, maxk = 0;
  8. for(int i = 0; i < n; i++) {
  9. int k, a; scanf("%d %d", &k, &a);
  10. maxk = max(k, maxk);
  11. int m = 0, s = 1;
  12. while(s < a) {
  13. s *= 4;
  14. m++;
  15. }
  16. p = max(p, k+m);
  17. }
  18. if(p == maxk) {
  19. p++;
  20. }
  21. printf("%d\n", p);
  22. }
  23.  
Success #stdin #stdout 0s 2900KB
stdin
Standard input is empty
stdout
1