Woburn Challenge 2018-19 Round 1 - Senior Division

Problem 2: Essay Generator

Alice has a W-word essay due tomorrow (1 ≤ W ≤ 10,000), but she's too busy programming to bother with that! However, Alice happens to know that H.S. High School's English teacher is sick of reading and grading long essays, so she figures that if she just submits a "reasonable" essay which fulfills the requirements but is as short as possible, she may get some pity marks!

As such, Alice wants to write a program to generate a sequence of W words to pass off as her essay, where each word is any string consisting of 1 or more lowercase letters ("a".."z") (not necessarily a real English word). The essay will have no punctuation or formatting, as those seem unnecessary to Alice. In an attempt to disguise the essay's generated nature, Alice will insist that all W words are distinct. Finally, for her plan to come together, she'll make the sum of the W words' lengths as small as possible.

Help Alice generate any essay which meets the above requirements.

Subtasks

In test cases worth 5/20 of the points, W ≤ 20.
In test cases worth another 5/20 of the points, W ≤ 100.

Input Format

The first and only line of input consists of a single integer, W.

Output Format

Output a single line containing Alice's essay: a sequence of W distinct space-separated words, with the sum of their lengths minimized.

Sample Input

2

Sample Output

i a

Sample Explanation

The sum of the lengths of the two words "i a" is 1 + 1 = 2, which is the minimum possible total length of a two-word essay. Various other essays (such as "x y") would also be accepted. However, the essay "i i" would not be accepted due to its words not being distinct, and the essay "i am" would not be accepted due to the total length of its words (1 + 2 = 3) not being as small as possible.

All Submissions
Best Solutions


Point Value: 10 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Nov 17, 2018
Author: SourSpinach

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

For some reason, it says that I'm getting the wrong answer, but I've checked and it seems like it's right. Any insight?

Re-read the question and note the constraints.