fork download
  1. # fbabedc9702742888e662401f66f327b.py
  2.  
  3. # Общие установки.
  4. # (Присутствуют в обоих программах)
  5. commands = ("hello", "hi")
  6. inp = ("Hi, Racel!").lower()
  7.  
  8. # Программа №1
  9. for _iteration in range(10000000):
  10. for command in commands:
  11. if command in inp:
  12. break
  13.  
  14. # Второй (из трех) вывод timeit.
  15. '''
  16. C:/Users/Shamus_Rezol/Desktop/Temp programs/Data>timeit python fbabedc9702742888e662401f66f327b.py
  17.  
  18. Version Number: Windows NT 6.2 (Build 9200)
  19. Exit Time: 2:25 pm, Wednesday, October 14 2020
  20. Elapsed Time: 0:00:03.195
  21. Process Time: 0:00:03.171
  22. System Calls: 18687
  23. Context Switches: 4204
  24. Page Faults: 5008
  25. Bytes Read: 389047
  26. Bytes Written: 52584
  27. Bytes Other: 164016
  28. '''
  29.  
  30. # Среднее время выполнения:
  31. # (3.195 + 3.307 + 3.242) / 3 = 3.248 секунд
  32.  
  33.  
  34. # Программа №2
  35. for _iteration in range(10000000):
  36. any(map(lambda command: command in inp, commands))
  37.  
  38. # Второй (из трех) вывод timeit.
  39. '''
  40. C:/Users/Shamus_Rezol/Desktop/Temp programs/Data>timeit python fbabedc9702742888e662401f66f327b.py
  41.  
  42. Version Number: Windows NT 6.2 (Build 9200)
  43. Exit Time: 2:27 pm, Wednesday, October 14 2020
  44. Elapsed Time: 0:00:07.012
  45. Process Time: 0:00:06.859
  46. System Calls: 22223
  47. Context Switches: 5754
  48. Page Faults: 3265
  49. Bytes Read: 451228
  50. Bytes Written: 238150
  51. Bytes Other: 169330
  52. '''
  53.  
  54. # Среднее время выполнения:
  55. # (7.277 + 7.012 + 7.002) / 3 = 7.097 секунд.
  56.  
  57.  
  58. # Вывод:
  59. # Вторая программа медленнее первой.
  60.  
Time limit exceeded #stdin #stdout 5s 9060KB
stdin
Standard input is empty
stdout
Standard output is empty