fork download
  1. def parse(inFile):
  2. i = inFile.getInts()
  3. return tuple(i[1:3]+[i[3:]])
  4.  
  5. def solve((S,p,scores)):
  6. bestunsurprising = 3 * p - 2 if (p > 0) else 0
  7. bestsurprising = 3 * p - 4 if (p > 2) else p
  8. return len([score for score in scores if score >= bestunsurprising]) + min(S,len([score for score in scores if bestunsurprising > score and score >= bestsurprising]))
  9.  
  10. if __name__ == "__main__":
  11. from GCJ import GCJ
  12. GCJ(parse, solve, "/Users/lpebody/gcj/2012_q/", "b").run()
  13.  
  14.  
  15.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty