gfonn's blog

By gfonn, 8 years ago, In English

Hi everyone! I can't solve this problem, can you help me please?

Statement:

Given a list of words, you have to find an order in which a word A can be before to word B only if the last letter of A is the same that the first letter of B. This order must be circular, like this:

(LEFT: Given words. RIGHT: A possible ordering of the words)

Input: First line, the quantity of words N (1 <= N <= 9000). Next N lines have the words (one word per line). Lenght of each word don't exceed 6:

6
arbol
orden
susana
otro
listo
nexos

Output: If it's possible to make the circular ordering, print N lines with the words ordered (as the ordering is circular, you can start listing them with any word). If it's impossible, print "Impossible"

susana
arbol
listo
otro
orden
nexos

FULL STATEMENT (IN SPANISH)

The first thing I know is that for finding the ordering you only need two letters (first and last of each word). I was thinking in Hamiltonian Cycle, but the input is too big.

Full text and comments »

  • Vote: I like it
  • +2
  • Vote: I do not like it

By gfonn, history, 8 years ago, In English

Hi! I was reading the problems of WF 2015 and I noticed that the time limit is HUUUGE, for example this https://icpc.kattis.com/problems/tiles

Why is it so much big? I know that there are many test cases in just one input, but I have seen the same in other problems from WF 2015 that have only one test per input.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By gfonn, history, 9 years ago, In English

Hi everyone! Yesterday I saw that today there'll be a contest in an hour. I don't remember the exact name, but there was something like "blablabla Introductory blabla". Do you remember too? Why it was canceled? Thanks.

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it