fork download
  1. # https://c...content-available-to-author-only...s.com/problemset/problem/106/B
  2. ##
  3. ##
  4. ## 5 (numarul de laptop-uri)
  5. ##
  6. #laptop 1: 2100 512 150 200
  7. # 2: 2000 2048 240 350
  8. # 3: 2300 1024 200 320
  9. # 4: 2500 2048 80 300
  10. # 5: 2000 512 180 150
  11. ##
  12. class laptop:
  13. def __init__(self,speed, ram, hdd, cost):
  14. self.speed = speed
  15. self.ram = ram
  16. self.hdd = hdd
  17. self.cost = cost
  18.  
  19. def solve_problem_laptop():
  20. #citim numarul N de laptopuri din Input Standard
  21. n = int(input())
  22. #declaram un vector sau un array de laptop-uri, unde laptop este o clasa
  23. vec = [ laptop ] * n
  24. #print( vec )
  25. for i in range( n ):
  26. #read speed, ram, hardisk, cost
  27. s, r, h, c = map(int, input().split())
  28.  
  29. #adaugam un vector fiecare instanta a clasei laptop
  30. vec[ i ] = laptop( s, r, h, c )
  31.  
  32. #print(vec)
  33. com = [ 0 ] * n
  34.  
  35. #n = numarul de laptopuri
  36. for i in range( n ):
  37. for j in range( n ):
  38. if i != j:
  39. if vec[i].speed < vec[j].speed and vec[i].ram < vec[j].ram and vec[i].hdd < vec[j].hdd:
  40. com[ i ] = 1
  41. break
  42. #print(com)
  43. maximum = int(1e12)
  44. idx = -1
  45. for i in range(n):
  46. if com[i] == 0:
  47. if maximum > vec[i].cost:
  48. idx = i + 1
  49. maximum = vec[i].cost
  50. print(idx)
  51. solve_problem_laptop()
Success #stdin #stdout 0.03s 9872KB
stdin
5
2100 512 150 200
2000 2048 240 350
2300 1024 200 320
2500 2048 80 300
2000 512 180 150
stdout
4