Courses
  • IITGN
  • Online
  • Short Courses
  • Other

ES242. Data Structures and Algorithms I. Week 02 Lab

ES242. Data Structures and Algorithms I.

Lab 02
Problem 1. Four Points

There is a rectangle in the xy-plane. Each edge of this rectangle is parallel to the 2or y-axis, and its area is not zero.

Given the coordinates of three of the four vertices of this rectangle, (P,Q), (A,B), and (X,Y), find the coordinates of the other vertex.

Constraints

All numbers are between -100 and +100.

There uniquely exists a rectangle with all of (P,Q), (A,B), and (X,Y) as vertices, edges parallel to the xor y-axis, and a non-zero area.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

P Q
A B
X Y

Output

Print the sought coordinates (x,y) separated by a space in the following format:

R S

Sample I/O

Sample Input 1

-1 -1
-1 2
3 2

Sample Output 1

3 -1

The other vertex of the rectangle with vertices (−1,−1),(−1,2),(3,2) is (3,−1).

Problem 2. Waking Up

Problem Statement

One day, Tina got up at exactly B minutes past A o’clock (in 24-hour clock), and Rahul got up at exactly D minutes and 1 second past C o’clock.

If Tina got up earlier than Rahul, print Tina; otherwise, print Rahul.

Constraints

  • 0 < A < 23
  • 0 ≤ B ≤ 59
  • 0< C < 23
  • 0 ≤ D ≤ 59
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C D

Output

If Tina got up earlier than Rahul, print Tina; otherwise, print Rahul.

Sample I/O

Sample Input 1

7 0 6 30

Sample Output 1

Rahul

Sample Input 2

7 30 7 30

Sample Output 2

Tina
Problem 3. Ratings

Codeforces separates its users into 4 divisions by their rating:

  • For Division 1: 1900 ≤ rating
  • For Division 2: 1600 ≤ rating ≤ 1899
  • For Division 3: 1400 ≤ rating ≤ 1599
  • For Division 4: rating ≤ 1399

Given a rating, print in which division the rating belongs.

Input

The first line of the input contains an integer 𝑡 (1≤𝑡≤10^4) — the number of testcases.

The description of each test consists of one line containing one integer rating (−5000≤rating≤5000).

Output

For each test case, output a single line containing the correct division in the format “Division X”, where 𝑋 is an integer between 1 and 4 representing the division for the corresponding rating.

Sample I/O

Sample Input 1

7
-789
1299
1300
1399
1400
1679
2300

Sample Output 1

Division 4
Division 4
Division 4
Division 4
Division 3
Division 2
Division 1

Note

For test cases 1−4, the corresponding ratings are −789, 1299, 1300, 1399, so all of them are in division 4.

For the fifth test case, the corresponding rating is 1400, so it is in division 3.

For the sixth test case, the corresponding rating is 1679, so it is in division 2.

For the seventh test case, the corresponding rating is 2300, so it is in division 1.

Problem 4. Meta Tic-Tac-Toe [Open Ended]
Note

This is an optional and open-ended problem. Feel free to get creative.

Examine the rules of Ultimate Tic Tac Toe and write your own implementation of the game.

Made with Quarto and 🩶

 

Content by Neeldhara Misra