Skip to content

Instantly share code, notes, and snippets.

@BayronVazquez
Last active August 12, 2022 02:55
Show Gist options
  • Save BayronVazquez/1b960661cc911b5b23ea4571fac5a3a3 to your computer and use it in GitHub Desktop.
Save BayronVazquez/1b960661cc911b5b23ea4571fac5a3a3 to your computer and use it in GitHub Desktop.
Michelle got a job as a teacher at the university. Michelle teaches in the same auditorium with another teacher, but she has forgotten where this auditorium is. Michelle knows how many students she has in the group a and how many auditoriums b in the university, their capacity c and how many students are inside d.

GOAL

Michelle got a job as a teacher at the university. Michelle teaches in the same auditorium with another teacher, but she has forgotten where this auditorium is. Michelle knows how many students she has in the group a and how many auditoriums b in the university, their capacity c and how many students are inside d.

Source: https://www.codingame.com

INPUT

Line 1: An integer number a of students in Michelle's group.

Line 2: An integer number b of auditoriums in the university. Next b lines: Two space separated integers c and d for the capacity each other auditorium and studens are inside

OUTPUT

Line 1: The numbers of the auditoriums that can accommodate a group of Michelle If there are no free auditoriums, print "No free"

Constraints

10 ≤ a ≤ 60
1 ≤ b ≤ 100
30 ≤ c ≤ 100
0 ≤ d ≤ c

CASES

INPUT 1

15
4
30 23
30 9
40 37
100 27

OUTPUT 1

2
4

INPUT 2

50
100
70 7
30 6
30 19
80 24
100 47
100 82
70 69
50 44
80 67
30 16
100 75
100 16
100 34
30 29
60 5
70 12
50 38
80 16
60 33
30 29
70 3
50 45
90 13
90 15
60 25
90 6
60 35
60 9
100 78
90 73
60 40
70 4
40 29
30 4
40 14
50 43
100 18
60 33
60 53
60 50
80 68
30 4
100 22
30 8
40 7
40 17
80 72
30 28
80 79
80 27
90 42
60 15
80 73
40 23
90 16
50 31
100 63
60 56
30 5
40 10
100 13
90 71
100 73
50 23
60 13
30 4
90 35
80 72
40 35
60 48
30 12
50 29
80 41
60 4
60 16
40 33
90 36
30 27
60 19
80 51
40 37
60 15
60 25
50 33
100 46
50 49
90 78
100 92
60 56
40 14
60 41
50 27
80 70
100 68
60 49
70 41
50 46
90 81
40 16
30 1

OUTPUT 2

1
4
5
12
13
15
16
18
21
23
24
26
28
32
37
43
50
55
61
67
74
77
85

INPUT 3

50
3
40 20
30 10
35 10

OUTPUT 3

No free

INPUT 4

30
60
70 41
70 52
50 42
90 74
50 19
80 47
80 19
90 53
30 19
80 20
90 41
50 30
60 37
90 20
50 36
50 50
50 25
40 1
40 10
30 15
90 38
90 33
60 33
90 70
30 10
100 38
60 29
100 5
50 12
80 61
50 23
40 16
30 28
90 12
80 71
100 46
70 12
80 22

OUTPUT 4

5
6
7
8
10
11
14
18
19
21
22
26
27
28
29
34
36
37
38
39
40
41
46
47
54
55
56
a,_,*b=open(0)
c=1
t=[]
for i in b:d,e=map(int,i.split());t+=[c]*(d-e>=int(a));c+=1
print(*t,sep='\n')if len(t)else print('No free')
import sys
import math
a = int(input())
b = int(input())
f=True
for i in range(b):
c, d = [int(j) for j in input().split()]
if c-d>=a:
print(i+1)
f=False
if f:
print('No free')
import sys
import math
a = int(input())
b = int(input())
h = []
for i in range(b):
c, d = [int(j) for j in input().split()]
if ((d + a) <= c):
h.append(str(i + 1))
if len(h) == 0 :print("No free")
else:[print(k) for k in h]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment