This page is still under construction.

Parts of this page are still being built. What you see may change.

Starman

Time limit1sMemory limit128 MB

Summary
Given up to 100 year ranges, print the Bowie albums released within each range, in release order, with a count first.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

In January 2016 the rock star David Bowie died. Jaehyun wanted to honor him, so he designed a program called RDBMS (Rockstar David Bowie Memorial System). RDBMS runs on a very small query language named SQL (Starman Query Language).

An SQL query is a pair of integers SS and EE. It asks for every David Bowie album released on or after January 1 of year SS and on or before December 31 of year EE, listed in release order.

The table below is the complete album list used for judging. It is sorted by release order, and albums released in the same year keep the order shown in the table.

Release yearAlbum name
1967DavidBowie
1969SpaceOddity
1970TheManWhoSoldTheWorld
1971HunkyDory
1972TheRiseAndFallOfZiggyStardustAndTheSpidersFromMars
1973AladdinSane
1973PinUps
1974DiamondDogs
1975YoungAmericans
1976StationToStation
1977Low
1977Heroes
1979Lodger
1980ScaryMonstersAndSuperCreeps
1983LetsDance
1984Tonight
1987NeverLetMeDown
1993BlackTieWhiteNoise
19951.Outside
1997Earthling
1999Hours
2002Heathen
2003Reality
2013TheNextDay
2016BlackStar

Help Jaehyun and write a program that answers SQL queries.

Input

The first line contains the number of queries QQ (1≤Q≤1001 \le Q \le 100).

Each of the next QQ lines contains one query: two integers SS and EE separated by a space (1≤S≤E≤20161 \le S \le E \le 2016).

Output

For each query print the following.

  • On the first line print AA, the number of albums that satisfy the query.
  • On each of the next AA lines print one of those albums in release order. Each line has the form "release year album name", with the year and the name separated by a single space.

Album names must match the table exactly, including capitalization. Do not print a blank line between queries.

Examples2

  1. Example 1

    Input
    3
    1973 1973
    1977 1979
    2014 2015
    
    Expected output
    2
    1973 AladdinSane
    1973 PinUps
    3
    1977 Low
    1977 Heroes
    1979 Lodger
    0
    
  2. Example 2

    Input
    1
    1 2016
    
    Expected output
    25
    1967 DavidBowie
    1969 SpaceOddity
    1970 TheManWhoSoldTheWorld
    1971 HunkyDory
    1972 TheRiseAndFallOfZiggyStardustAndTheSpidersFromMars
    1973 AladdinSane
    1973 PinUps
    1974 DiamondDogs
    1975 YoungAmericans
    1976 StationToStation
    1977 Low
    1977 Heroes
    1979 Lodger
    1980 ScaryMonstersAndSuperCreeps
    1983 LetsDance
    1984 Tonight
    1987 NeverLetMeDown
    1993 BlackTieWhiteNoise
    1995 1.Outside
    1997 Earthling
    1999 Hours
    2002 Heathen
    2003 Reality
    2013 TheNextDay
    2016 BlackStar