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

Блог пользователя JAGRAT

Автор JAGRAT, история, 2 года назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится