This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # O(N*Log(N)) -- Custo da ordenação, solução ótima | |
| N = int(input()) | |
| tipos = list(map(int, input().split())) | |
| precos = list(map(int, input().split())) | |
| C = int(input()) | |
| compradores = list(map(int, input().split())) | |
| # Separa os preços em duas listas, uma lista pra cada tipo | |
| t1 = [] | |
| t2 = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # O(N) -- Solução ótima | |
| P = list(map(int, input().split())) | |
| C = list(map(int, input().split())) | |
| # Inicia de 1 porque o primeiro item da lista é a quantidade de gols | |
| ponteiroP = 1 | |
| ponteiroC = 1 | |
| # Placar sempre começa em 0 | |
| print('0 0') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # O(1) -- Solução ótima | |
| N, M = map(int, input().split()) | |
| if (N - 1) * 4 + N <= M: | |
| print("S") | |
| else: | |
| print("N") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A commercial establishment implemented a service system with a single queue, | |
| // in which people always enter at the end of the queue, except if they are elderly (those over | |
| // 59 years old), who always enter before the person younger than him who is closest to the | |
| // start of the queue. | |
| // Implement a program to control this queue, in order to meet the requirements | |
| // above. | |
| // The program must read a sequence of people, each one with their age and the time they entered. | |
| // Considering that each person is attended in 3 minutes, the program must print the queue at each time a person enters it. | |
| #include<stdio.h> |
