All submissions for this problem are available.
Mrs. Mashini is doing lectures for UWU students. She usually tell "Come forward!" to students in the back rows. Front rows are the first 50% rows of all rows and in other hand back rows are the rest. When she told "Come forward!", Students in the back rows are moving to available front seats.
Specially when they are moving they usually chek whether all students in the same back row can move to available single front row .
If there is no possibility to move (not enough available seats in front rows) they will stay and not going to move anywhere. also once students moved into a row in front none of students will come to that row again.it's guarranteed that none of back row is empty.
There are 4 rows and row 3 and row 4 is identified as back rows (Because first 50% are front rows).
When she told "Come forward!" Student in the row 1 can move in to row 1 and those 3 students in last row will go to row 2. We print 2 as the answer because 2 rows can move by maximizing no of students.
First line is No of rows (T) in the lecture hall Each T lines will give Total seats in current row - X and Total students sitting in particular row - Y as pairs
Print single integer Z has the value of how many number of rows can move from back row to front row by maximizing the number of students who will move.
- T is always even
- 2 ≤ T ≤ 100
- 2 ≤ Y ≤ X ≤ 100 Y != 0 for back rows
Input: 4 4 2 3 0 3 1 5 3 Output: 2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions