Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

At coder interactive problem sort N things in not More than Q queries

Правка en2, от JAGRAT, 2022-08-20 17:04:25

I am trying to solve an interactive problem from atcoder's practice contest. The abridged problem statement is as follows:

Given the value of N where N ranges from [1,26] and Q where Q is the maximum number of queries that one can make, sort a list of distinct uppercase alphabets in ascending order. N indicates that there are N characters starting from 'A'. Hence, N = 5 means that our final list must contain 'A', 'B', 'C', 'D' and 'E'.

A single query is defined as printing out a string "? x y" where x and y represent the characters we want to check the relation between (e.g. "? A B"). The problem restricts the number of such queries to Q. Hence, we must determine the final order of the characters using at most Q queries.

For each query, we get a binary answer '<' or '>' from stdin. '<' indicates that x comes before y in the final list. '>' means otherwise. Problem link: here (Do note that atcoder account is needed to view the task) https://atcoder.jp/contests/practice/tasks/practice_2

Теги atcoder.jp, sorting, interactive problem, interactive sorting, queries

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский JAGRAT 2022-08-20 17:04:25 55 Tiny change: ' the task)' -> ' the task)\nhttps://atcoder.jp/contests/practice/tasks/practice_2'
en1 Английский JAGRAT 2022-08-20 17:03:51 1024 Initial revision (published)