ritesh1340

MAXEP AC soln

Dec 17th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. n,c=map(int,raw_input().split())
  2.  
  3. import sys
  4.  
  5. low=1
  6. high=n
  7. Purse=1000
  8.  
  9. while True:
  10.  
  11.     mid=int(((low*3.5)+high)/4.5)
  12.     print 1,mid    
  13.     Purse-=1
  14.     #print "Balance : ",Purse
  15.     sys.stdout.flush()
  16.  
  17.     result=input()
  18.  
  19.     if result==1:
  20.         Purse=Purse-c
  21.         print 2
  22.         sys.stdout.flush()
  23.         high=mid-1
  24.        
  25.     elif result==0:
  26.         low=mid+1
  27.  
  28.     if high-low+c<Purse:
  29.         #print "\n\nLinear\n\n"
  30.         break
  31.            
  32. #print low,high,Purse
  33.  
  34. for i in range(low,high+1):
  35.     print 1,i
  36.     sys.stdout.flush()
  37.  
  38.     result=input()
  39.     if result==1:
  40.         print 2
  41.         sys.stdout.flush()
  42.         print 3,i
  43.         sys.stdout.flush()
  44.         break
Add Comment
Please, Sign In to add comment