AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

DAPC23-050.Better Dice

Medium · 1 s · 256 MB

  • icpc
  • dapc
  • 2023

The latest Table-Top Role Playing Game is out now: Better Dice. Unlike all other TTRPGs, this one is all about dice. In fact, it is all about the better die: decisions are made, friendships gained and lost, fights fought, battles won, all based on who has the better die.

This game uses special nnn-sided dice where each of the nnn faces has the same probability of being rolled. Moreover, each die has its own special set of nnn numbers on the faces.

While playing Better Dice you ended up in a very precarious situation where you must absolutely have a better die than your opponent, that is, you must roll higher than your opponent. Given both your die and your opponent's die, decide who is more likely to roll a higher number.

Giriş formatı

The input consists of:

• One line with an integer nnn (1≤n≤10001\leq n\leq 10001≤n≤1000), the number of sides on each die.

• Two lines, each with nnn integers ddd (1≤d≤1091 \leq d \leq 10^91≤d≤109), the values on one of the dice.

Çıxış formatı

Output “first” if the first die is more likely to roll a higher number than the second die. Output “second” if the second die is more likely to roll a higher number than the first die. Output “tie” if they are both equally likely to come up higher than the other.

Qeyd

Source: Delft Algorithm Programming Contest 2023 · Author: Mees de Vries · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license.

Nümunələr

Giriş #1

2
4 6
5 5

Çıxış #1

tie

Giriş #2

6
1 2 3 4 5 6
7 6 5 4 3 2

Çıxış #2

second

Giriş #3

3
2 2 2
1 1 8

Çıxış #3

first