This time the language is Ada, chosen not for being particularly crazy (it's too Pascal-like to my taste) but for its name. Indeed, a language named for Ada Lovelace seems to be a perfect fit for programmers' professional holiday. I tried to balance the lack of language weirdness by problems somewhat less trivial than usual.
Here is the traditional solution for "A+B" problem (integers A and B can be given in one line):
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure AplusB is A, B: Integer; begin Get(Item => A); Get(Item => B); Put(Item => A + B, Width => 1); end AplusB;
The testing system uses gnat 4.7.2. To test your programs before submitting, you can:
- use “Custom test” tab in the contest interface.
- use ideone, language Ada (gnat-4.6). Remember that by default programs submitted by anonymous are shown in “recent codes”; to avoid this I recommend registering and using "private" privacy option or at least use "secret" option.
- install the compiler locally.
If you use Linux, this compiler is present in the repositories (version 4.4.3 for my Kubuntu). After installing the compiler use
gnat make file.adb to compile the code and create the executable. If you have mingw installed, you can run
mingw-get install ada and then compile
September 13th will be Friday the 13th, Programmers' Day — this year not only a professional holiday but also a Surprise Language Round!
The rules of the contest are as follows:
- The contest is unrated for everybody.
- The round uses ACM ICPC rules: the standing is defined by the number of solved problems, ties are resolved based on penalty time. Initially the penalty is 0, and for each solved problem it is increased by submission time (since the start of the contest) + 20 minutes for each failed submission. The solution is considered to be correct if it passes all tests from a predefined test set; you know whether the solution is right immediately after sending it. There are no hacks
- The round has 7 problems, sorted by estimated complexity, and you have 2 hours to solve it.
- Solutions are accepted only in one language, which will be announced at the beginning of the contest. The language was created a while ago, we didn't invent it for this occasion.
- Please reread this post at the beginning of the contest: we will announce the language and add instructions to install the compiler (the contest interface will provide an option to run your solutions online as well) and links to useful manuals. Other than that, learning the language is up to the competitor. You can use any resources to solve the problems (as long as you remember that this is an individual competition); you don't have to limit yourself to the manuals provided in the post.
We hope that the language we chose will be unknown to most of the competitors.
The contest is over; I hope you've enjoyed it. 1465 participants submitted at least one problem correctly. Unfortunately, nobody managed to solve all 6 problems; congratulations to ShadowSong who won the contest by solving 5 first problems with the lowest penalty time!
Last year we've verified that a lack of problem statement doesn't prevent participants from solving and submitting the problem successfully and at the same time saves the problem setter some writing effort. This year we've ascertained this again. Well, I could've invented a long and knotty legend about you, a young but very promising software developer, were summoned to White House and given a task of utmost importance: to deliver an interactive list of USA presidents from founding fathers to our days. It could have featured a dramatic time-consuming search for necessary info, pursuits, firefights, a wounded teammate whose dying words were "Eight is Van Buren, don't forget... print Van, just Buren... doesn't pass". But what for?
The contest editorial is available here.
Some jokes are fun only for the first time, repeating them makes them lose their charm. I certainly hope that April Fools Day Contest is not the case, but there's only one way to verify this :-) I'm happy to invite you to take part in the verification process which will take place on Monday April 1st. Let me disprove the suspicions some people have: the joke is the contest contents, not the fact of its existence or the lack of it — that would have been too simple :-)
In this round you'll face several weird problems and 2 hours to solve them. The contest will be unrated (you bet!), and it will follow ACM ICPC rules (no hacks, the standings are decided by the number of solved problems and penalty time earned on them). You can submit solutions in any language allowed by Codeforces. To get an idea of what awaits you, you can have a look at the last year's contest.
Be warned, to enjoy participation in this round you'll need a sense of humor compatible with mine! It's April Fools Day, after all. Good luck!
Upd. Registration is open till the end of the contest.
A couple of days ago I wondered how many authors (except for me) write problems about programming languages. I was hoping to be not alone in my passion to this topic; but the reality exceeded all expectations. Of course, problems which feature programming languages are much scarcer than ones about computers, processors, microchips, parallel computing, databases and other IT things, but still much more frequent than ones about, say, dragons :-)
The early years of TopCoder presented the participants with several programming-languages-featuring problems.
Roco is a very simple language. On one hand, it's esoteric, so everything you need to know about it fits in two pages. On the other hand, it's powerful enough to enable writing rather complicated programs in it without racking one's brains over each elementary operation (like in Brainfuck). Being able to refer variables using names (numerical, but names nevertheless) is already a gift to the programmer :-)
As usual, the first problem tests the competitor's understanding of basic arithmetic operations. The solution is very similar to the example.
iin  mul   2 dec  mul    iout  ac
Starting with the second one, the problems need learning the main feature of the language — the coroutines.
The contest is over; the editorial is here. I've mis-estimated the complexity of the problems — but how could I possibly guess who will arrive and finish everything in 40 minutes :-) Congratulations to the winners — the slowest and the most relaxed of them took under an hour to solve all the problems.
Today's round features Roco — a little-known esoteric language with a special approach to loops and subroutines. The programs written in it look a bit bulky, especially when compared to Befunge, but this is compensated by their relative simplicity and readability. Here is a program which calculates the sum of two given numbers:
iin  iin  add    iout  ac
There is also exactly one interpreter for Roco, written by its author. To run it, one has to have C++ installed (the author uses g++, and so do we), compile the interpreter source code into an executable file and run programs using command "roco program.roco". You can download the interpreter here.
Challenge24 finals are finally over, and as usual, I hurry to share my impressions about them. The impressions are sponsored by team Progopedia (Andrii Maksay a.k.a. maksay, Sergii Dymchenko a.k.a. kit1980 and me). Such things are the best to write immediately after the contest, while the emotions still invade you. Of course, one can start writing them while still in the competition (and last year I did so — I was pretty useless at night anyways), but this year we felt alert and fought for the points till the last minutes of the contest, so the blog post was postponed.
The main part of Challenge 24 took a bit less than 48 hours: registration and optional sightseeing on Friday, the round itself from Saturday morning to Sunday morning, and winners announcement and closing ceremony (for the toughest contestants who don't really need all that sleep) on Sunday noon.
I'm a huge fan of Surprise/Unknown Language Round competition format. Theoretically I enjoy participating in them, but in practice I mostly run them. What's so special about them that makes me like them so much?
They are unusual. At some point of time (which arrived pretty soon for me) traditional competitions pall and become a blur. If I give it a thought, I can clearly remember only a couple of the 80 SRMS and CF rounds I've done. The SRM which featured MooresLaw problem (great challenge phase and my only ever room win), TCO elimination round which I passed thanks to a last-minute submission on 500pt, a GCJ round from back when it was held on TopCoder platform, when I got stuck at input parsing and never got to the actual solution... and that's all. Marathon memory is a bit better, probably because I've participated in fewer of them, and each match took more time and effort. But unusual competitions leave the most lasting and vivid impression.
They fit my skills. I'm not the one to get intimidated, let alone scared by a language which misses loops, strings or anything else from the commonly used programmer's toolkit. Well, there are a couple of languages which I'm uneasy about, but they are very unlikely to appear in an ULR.
Congratulations to KADR who was the first of two people to solve all 8 problems!
The easiest way to make the problem statement unusual is to omit it. This is an extremely convenient approach — you don't have to maintain the statement in two languages or to worry that it might turn out to be ambiguous or too long or too scary. 690 people solved this problem, so evidently we can omit statements even in regular rounds :-)
As for the problem itself, it required to sum the first number and the reverse of the second number.
They say it's better to see once than to hear ten times or to read a hundred times. In this problem we decided to check this and to replace the traditional textual statement with a single image. Same as in the previous problem, it did well — at least 645 participants recognized star numbers (sequence http://oeis.org/A003154 in OEIS), the numbers of balls needed to form a six-pointed start of certain size. After this one had only to code the formula —
You might have already noticed the next contest in the events calendar, the one named April Fools Day Contest. The name hints that the contest is unusual, nowhere near serious and maybe even snide. One could even guess the author of the contest — the meanest of all out there, that would be me :-)
I love unusual contests — Surprise/Unknown Language which require solutions in unusual languages, Time Limit Exceeded which require solutions in C but written in an unusual manner... Most of such contests exploit the domain of unusual solutions. I've decided to take a peek at the dual domain — unusual problem statements.
In this round you'll be given several weird problems and 2 hours to solve them. The contest will be unrated (you bet!), and it will follow ACM ICPC rules (no hacks, the standings are decided by the number of solved problems and penalty time earned on them). You can submit solutions in any language allowed by Codeforces — of course, unless the problem says otherwise :-)
Be warned, to enjoy competing in this round you'll need a sense of humor compatible with mine! It's April Fools Day, after all. Enjoy!
P.S. This contest exists solely due to maksay who volunteered to do all technical preparations. Thanks!
So here goes the editorial. Note that Factor allows pretty random codes, feel free to put all words in one line, but all words must be separated by at least one space, don't try to skip a space between a bracket and a word or something like that.
This problem was almost the same as 130A - Hexagonal numbers from Befunge round. Data input and output is done exactly as in the sample code, and besides them the program needs only basic stack operations.
USING: io kernel math math.parser ; readln string>number dup 3 * 1 - * 2 / number>string print
Factor has a very system of built-in libraries which liberate the programmer from solving a lot of basic routine tasks. So after the first (trivial) probllem I gave several one-liners
The contest is over. My sincere respect to the winner in overall run nab who solved all 10 problems in 1h 25m, and congratulations to the winner in the official contest winger who repeated this heroic deed in 1h 52m.
Here is the editorial.
The language of this round is Factor — a stack-based functional language with a sophisticated system of built-in libraries (dictionaries).
Anybody feels like sharing the thoughts about Challenge24 online round? Like who was in which team and who solved what? I miss the detailed information — participants' countries and total points earned is too little :-)
Here is the list of teams known so far:
|1||Havka-papstvo||Egor, Petr, pashka|
|4||Charles_University_Legion||fhlasek, mimino, k21|
|5||Progopedia||maksay, kit1980, Nickolas|
|8||Unpretired||Michael, ilyakor, Vasiliy Astahov|
|9||DrinkLess||arseny30, valich, levlam|
|13||_NiN_||ashmelev, mmatrosov, Anton Demidov|
|14||Saratov.SU2.Retired||ralekseenkov, ivanromanov, Igor Kulkin|
|16||petrsu_ginger||Eledven, zurg, Jughead|
|18||despise_oimaster||sevenkplus, wuzhengkai, Zekun Ni|
|20||any_random||Zhukov_Dmitry, zeliboba, ifsmirnov|
|22||PigsAndHedgehogs||Joshik, andrewzta, dgozman|
|27||Accept_iterator||asaveljevs, ulzha, visockas|
|33||PMP_Forever||poopi, Mohammad_jrs, piloop|
|34||KNURE_Team||SkorKNURE, DryukAlex, Daiver19|
|36||LT_United||Leonid, KrK, Lomir|
Here goes a review of the problems. I tried to set them so that each of them shows a certain aspect of the language — a commonly used verb or a specific feature. Once it was recognized and found, the solution should become evident.
Let me note right away that the sample code provided in the blog post does work both in Custom test and in ideone (as well as locally), as long as the numbers are written one per line and (attention!) each of them, including the last one, is followed by the end-of-line character. The last '\n' is not shown in the tests, but it is there, and COBOL minds it. All test cases at Codeforces are generated with this in mind, so there should be no problems like this when the code is submitted.
The most evident COBOL feature is storing numbers in decimal notation, with width set by the programmer. In this case we focused on the fact that by default the number is printed in a fixed-width way, padded with leading zeros if needed. These zeros where what you needed to get rid of.
The round is over, I hope you have enjoyed it. Here is the editorial.
The language of this round is COBOL (dialect COBOL85), one of the oldest programming languages (date of “birth”: 1959, so it’s twice older than I am). Despite being so old, it’s still in active use, though not in programming competitions, so I think it should be enough of a surprise for you :-)
The problem "A+B" (numbers A and B given in separate lines) can be solved in a following way:
IDENTIFICATION DIVISION. PROGRAM-ID. SOLUTION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC 9(10) VALUE ZEROES. 01 B PIC 9(10) VALUE ZEROES. 01 STR PIC X(10). PROCEDURE DIVISION. ACCEPT STR MOVE STR TO A ACCEPT STR MOVE STR TO B ADD A TO B DISPLAY B STOP RUN.
A couple of days ago I was asked to answer the question "What is it like to be a problem writer for programming competitions?" at Quora web-site. My first idea of the answer had only one word, but then I've thought of a more detailed one, and then of a story I must include, hmm, and I should definitely mention this... Around the second page I realized that this is becoming more than an answer, and at the third one I decided to share this article with a qualified audience — that would be you.
So, what is it like to be a problem writer for programming competitions?
In one word (the one I've thought of at first), it's "awesome". In a bit more detail, "hard, sometimes unrewarding, but anyways fascinating job". In even more detail...
А что, кто-нибудь планирует завтра участвовать в TLE? Минус, конечно, что в этом году участие индивидуальное, а не командное, лично мне в хорошей компании было веселее, но контест и сам по себе забавный — на те познания в языке C, в наличии которых в приличном обществе признаваться как-то даже неловко :-)
So, here goes the editorial. I'll tell you right away that nobody guessed MikeMirzayanov's problem (nice disguise, er?) — it was problem C about the picky princess. Actually, this was the first problem of the round, the rest of problems I invented to keep up the lovely topic.
The number of dragons D can be quite small, so the problem can be solved in a straightforward way, by iterating over dragons 1 through D and checking each dragon individually. Time complexity of such solution is O(D).
Codeforces Round #105 will take place on February 2nd, 20:00 Moscow time.
This is a themed round, based on the fairy tales I write in Russian.
In this round we decided to conduct an experiment on smoothing the effects of problem setters misestimating the complexities of the problems: all problems have point values of 1000. We tried to order the problems by increasing difficulty, but this is a subjective opinion, so surprises are possible.
Good luck at the round!
The Unknown Language Round format is becoming popular outside of Codeforces: Chaos. There are only 6 problems, which is less than an ULR typically has, and the problems themselves are easier, but that's a good start.
P.S. I know it's too late for a contest announcement but I had no time earlier - I even got late for the contest itself.
P.P.S. My report of the contest participation: Chaos Chef.
На днях открылась регистрация на замечательный контест венгерского происхождения Challenge24. Лично я его очень люблю - пожалуй, в списке моих любимых контестов он уступает только TopCoder Open. Это вполне естественно - все любят контесты, на которых их приглашают на онсайт в какие-нибудь интересные города :-) Поэтому я решила немного его прорекламировать (и даже сделать это заранее, чтобы не получилось как с CodeSprint).
Участие в контесте командное, причем в команде должно быть ровно три человека. Ограничений студент-не студент нет, равно как и на страну проживания, только что английский знать надо. Единственное требование - все участники должны предъявить подобающее резюме. Кстати, для поездки на онсайт можно заменить одного участника команды по сравнению с составом на момент онлайн-раунда. Очень гуманно, если учесть вопросы виз-денег-"да не поеду я, отстаньте со своими глупостями" :-)
Проводится контест в два этапа: Electronic Contest (онлайн отборочный раунд длиной 5 часов) и собственно финалы-онсайт (24 часа, но об этом я стараюсь не вспоминать) в Будапеште, на которые приглашают лучшие 27 команд по результатам онлайн раунда плюс 3 команды, занявшие первые места в прошлом году. Сразу уточню важный момент: в отличие от общеизвестных турниров, организаторы не оплачивают дорогу и проживание. Впрочем, бумажное приглашение для визы присылают исправно, если попросить как следует.
Codesprint закончился, можно обсудить задачи. Лично я полностью решила четыре штуки:
- Picking Cards - произведение ((количество карт номиналом < i) - i + 1) по i от 1 до N.
- Coin Tosses - рекурсия по количеству орлов, которые осталось выбросить с текущего момента; за один шаг рекурсии рассматриваю один бросок монеты, и получаю либо орла (переход к "осталось выбросить на одного орла меньше"), либо решку (переход к известному матожиданию числа бросков, нужных для того, чтобы выбросить N орлов подряд - 2N+1-2). Немного начудила - считала не в целых, а в Decimal (Python), так что преобразование в строку получилось страшноватое, но прошло.
Я тут отвлеклась ненадолго от всяческих спортивно-программных вещей и сделала новогодний квест. Правила и сообщения об исправленных багах (буде таковые объявятся) тут. А комментировать можно и здесь :-)
Update. Разбор заданий квеста.
The problem described HQ9+ programming language and asked whether the given program will print anything. Given the extraordinary simplicity of the language, it was enough to check whether the program contains at least one of the characters H, Q and 9.
Codeforces Beta Round #96 will take place on Saturday, December 3rd, and it will be my first classical Codeforces round. To smoothen the transition between Unknown Language and known ones, I've made the problems of the round follow a certain topic, which is of course programming languages :-)
P.S. Points cost for problems: division 1 — 500-1500-1500-2000-2500, division 2 — 500-1000-1500-2500-2500.