Under construction

Still being built. Things may change

Cheese Comparison

Interview

Time limit3sMemory limit1024 MB

Summary
Arrange a set of cheese wheels in order of weight, from smallest to largest, for a market display.
Level

Easy2 of 10

Topics
Sorting
Solved
No attempts yet

Cheese Comparison

Every Thursday, the big square in front of the New Church in Delft fills with market stands. Today you brought your cheese wheels to the market for the first time. To boost sales, you need to arrange them in an appealing way. From playing with blocks as a child, you know cheese wheels look best when ordered by weight, from smallest to largest.

A cheese wheel is large and circular, usually yellow, and has a crust on the outside that keeps the cheese inside fresh. It can weigh several kilos.

Examples2

  1. Example 1

    Input
    4
    
    >
    
    >
    
    >
    
    >
    
    =
    
    <
    
    
    Expected output
    
    ? 2 1
    
    ? 2 3
    
    ? 2 3
    
    ? 1 3
    
    ? 4 1
    
    ? 4 2
    
    ! 3 1 4 2
    
  2. Example 2

    Input
    3
    
    =
    
    =
    
    
    Expected output
    
    ? 2 1
    
    ? 1 3
    
    ! 2 1 3