MikeMirzayanov's blog

By MikeMirzayanov, 5 years ago, In English

Hello Codeforces!

I hope you enjoyed the problems. I forgot to mention the contribution of testers to the preparation of problems in the round announcement. I apologize and correct myself. Many thanks to the testers: elizarov, ashmelev, KAN, arsijo, adedalic and Roms. Also many thanks to my co-authors: 300iq and geranazavr555. Special thanks to cannor147 who helped with translations.

1211A - Три задачи

Problem writer: MikeMirzayanov

Tutorial

1211B - Путешествие по Золотому кольцу Берляндии

Problem writer: MikeMirzayanov

Tutorial

1211C - Мороженое

Problem writers: MikeMirzayanov, geranazavr555

Tutorial

1211D - Команды

Problem writer: MikeMirzayanov

Tutorial

1211E - Double Permutation Inc.

Problem writers: MikeMirzayanov, geranazavr555

Tutorial

1211F - kotlinkotlinkotlinkotlin...

Problem writer: MikeMirzayanov

Tutorial

1211G - Путь короля

Problem writer: MikeMirzayanov

Tutorial

1211H - Ремонт дорог в Древляндии

Problem writer: MikeMirzayanov

Tutorial

1211I - Необычный граф

Problem writer: 300iq

Tutorial

Full text and comments »

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

By MikeMirzayanov, 5 years ago, In English

Hello!

We are very pleased to cooperate with XTX Markets, thanks to whom we are able to hold the Global rounds. Four of the six of them are already passed and here are the current results.

In short, XTX Markets is a leading quantitative-driven electronic market maker Launched in 2015, XTX Markets has rapidly become the number 1 FX spot liquidity provider by volumes globally, surging ahead of global banks.

Thanks for supporting our community!

We are happy to announce that XTX recently launched the XTX Markets Global Forecasting Challenge, powered by Correlation One.

The XTX Markets Global Forecasting Challenge is an online competition for aspiring quantitative professionals, where contestants are tasked to develop a predictive model based on training data provided by XTX.

Competition highlights include:

  • Over $100,000 in total cash prizes.
  • $7,500 for the best submission from a participant aged under-25 (as of 1st July 2019).
  • Exciting job opportunities in London.
  • Opportunity to compete against the best quantitative minds from around the world.

The competition is open to all data-minded contestants from 1st of July to 30th of September, 2019.

To get started, please sign up below.

APPLY HERE→

We hope you'd be interested!

Full text and comments »

Tags xtx
  • Vote: I like it
  • +134
  • Vote: I do not like it

By MikeMirzayanov, 5 years ago, translation, In English

Hi Codeforces.

Recently there have been several improvements on the website. A little later, I will write a short note about them. Here I want to tell about a noticeable new functionality that has recently been implemented by kuviman.

Sometimes after the end of a round there are requests in comments to add a particular test. And problem writers or coordinators add it manually. Now this process is automated.

Meet the uphacking phase!

Now, after the end of almost any contest, participants from Div.1 have the opportunity to hack any solution in this contest during the week. Yes, including official solutions from rounds. In case of successful hacking:

  • Your test will be automatically added to the problem and will be used in the future when testing new solutions for this problem;
  • If a hacked solution is a practice (i.e. upsolving), then its verdict will change to “hacked” otherwise its verdict will remain unchanged;
  • The participant whose solution has been hacked will be notified via system private message;
  • Each solution can be successfully hacked only once.

In order to add only adequate and reasonable tests, it is forbidden to hack solutions that intentionally contain a mistake. Please strictly follow this rule. It is because of the possibility of inadequate behavior that we cannot open uphacking for everyone.

I hope that this innovation will be useful and tests for problems will become even better!

  • MikeMirzayanov

UPD: Probably, later we will extend uphacking phase and reduce the rating bound.

Full text and comments »

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

By MikeMirzayanov, history, 5 years ago, In English

Hello,

Do you remember my post New: Diagnostics of Solutions in C++? If not, please read it.

Recently, I've implemented better UI to show you diagnostics. Now in on the status pages sometimes you can notice something like this:

Click to the  and you'll see the code with the highlighted problematic line and description with the possible reason of the mistake.

Do you like it?

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

In 2019, with the support of XTX Markets, 6 rounds of the new Codeforces Global Rounds will be held. These will be common rounds for both divisions of 7–9 problems each. The duration of the rounds will be 2-3 hours, depending on the number and complexity of the problems. All such rounds will be rated for all participants. At each such round, 50 brand T-shirts will be handed out, and we will be happy to give T-shirts to all authors and problem testers.

The prizes for the 6-round series in 2019:

  • In each round top-100 participants get points according to the table.
  • The final result for each participant is equal to the sum of points he gets in the four rounds he placed the highest.
  • The best 20 participants over all series get sweatshirts and place certificates.

Current standings after two rounds:

Place Contestant = Round 1 Round 2
1 tourist 1706 1000 706
2 Um_nik 1281 706 575
3 ecnerwala 1000 1000
4 mnbvmar 900 497 403
5 sunset 814 443 371
6 TLE 599 575 24
7 ksun48 569 371 198
8 fateice 518 307 211
9 Endagorion 510 13 497
10 Petr 443 443
11 lych_cys 436 218 218
12 jqdai0815 403 403
13 yokozuna57 399 74 325
14 neal 382 211 171
15 molamola. 346 346
15 Rewinding 346 346
17 snuke 325 325
18 jonathanirvings 323 97 226
19 realDonaldTrunp 307 307
20 V--o_o--V 291 291
20 krijgertje 291 291
22 LHiC 277 277
22 yhx-12243 277 277
24 kmjp 272 226 46
24 ania 272 198 74
26 lumibons 265 265
26 visitWorld 265 265
28 sigma425 254 254
28 leaf1415 254 254
30 webmaster 246 60 186
31 zemen 245 204 41
32 uwi 244 244
32 Arterm 244 244
34 whzzt 241 171 70
35 dotorya 235 235
35 peltorator 235 235
37 MofK 206 8 198
38 vammadur 204 204
39 mareksom 201 99 102
40 AFO_OFA 194 78 116
41 riadwaw 192 192
42 yutaka1999 186 186
43 Kostroma 185 4 181
44 calabash_grandfather 181 181
45 voover 176 176
45 hos.lyric 176 176
47 Alex_2oo8 166 166
47 yosupo 166 166
49 TLEwpdus 161 161
49 supy 161 161
51 kdh9949 157 157
51 I_love_Tanya_Romanova 157 157
53 SpyCheese 153 153
53 E869120 153 153
55 Subconscious 149 149
55 maroonrk 149 149
57 mmaxio 145 145
57 Egor.Lifar 145 145
59 AghaTizi 142 142
59 Nazikk 142 142
61 eatmore 138 138
61 riantkb 138 138
63 VArtem 135 135
63 yuxiaogang 135 135
63 ainta 135 135
66 fyy2603 131 131
66 edisonhello 131 131
68 izban 128 128
69 voidmax 125 125
69 _rqy 125 125
69 KMAASZRAA 125 125
72 irkstepanov 122 122
73 Rzepa 119 119
73 jah_melon 119 119
75 aid 118 107 11
76 Egor 116 116
76 JOHNKRAM 116 116
78 G.Z.V.O.D.E.N 113 113
79 Cyanic 112 52 60
80 allllekssssa 110 110
80 kazuma 110 110
82 Maksim1744 107 107
83 weizhaohui 105 105
83 NoLongerRed 105 105
85 pobiren 102 102
86 Itst 99 99
87 TangentDay 97 97
87 chenjb 97 97
89 Merkurev 94 94
90 scanhex 92 92
90 sugim48 92 92
92 geniucos 90 90
92 dreamoon_love_AA 90 90
94 tfg 87 87
94 TimonKnigge 87 87
94 ToTLeS 87 87
97 Elegia 85 85
98 kczno1 83 83
98 Sugar_fan 83 83
100 _Happy_New_Year_ 80 80
100 131131yhx 80 80
102 Hazyknight 78 78
102 DEGwer 78 78
104 Roundgod 76 76
105 Radewoosh 74 74
106 Xellos 72 72
107 QAQAutoMaton 70 70
107 flying_fish 70 70
109 Vergara 68 68
109 oversolver 68 68
111 djq_fpc 66 66
112 hermano95 63 63
112 orz 63 63
114 laofudasuanbaofushehui 62 62
114 fuppy 62 62
116 ilyakor 60 60
116 kokokostya 60 60
118 Farhod 58 58
119 isaf27 56 56
120 craborac 54 54
120 superguymj 54 54
122 zerokugi 52 52
122 cuizhuyefei 52 52
124 kf11 50 50
124 Worteltje 50 50
126 imalyd 48 48
127 Reyna 46 5 41
127 Tommyr7 46 46
129 zeliboba 45 45
129 JettyOller 45 45
129 kobae964 45 45
132 natsugiri 43 43
133 wzp666 41 41
133 -14 41 41
135 camypaper 39 39
136 yfzcsc 37 37
137 orbitingflea 36 36
137 SidneyEarth 36 36
137 logicmachine 36 36
140 zhou888 34 34
141 fedoseev.timofey 32 32
141 hloya_ygrt 32 32
143 chemthan 31 31
143 Hezhu 31 31
145 satashun 29 29
145 why_no_girlfriend 29 29
147 HanwhaEagles 27 27
147 zhangqingqi 27 27
147 PinkieRabbit 27 27
150 gazelle 26 26
151 lzyrapx 24 24
152 DAyamaCTF 22 22
152 athin 22 22
154 cerberus97 21 21
154 Sonechko 21 21
156 HuaJun 19 19
156 WA_TLE 19 19
158 GyojunYoun 17 17
158 Rebelz 17 17
160 FizzyDavid 16 16
160 jijiang 16 16
162 cz_yixuanxu 14 14
162 gyz_gyz 14 14
162 majk 14 14
165 adadadd 11 11
165 AprilGrimoire 11 11
167 endless-chase 10 10
168 amnesiac_dusk 8 8
169 teapotd 7 7
169 BigBag 7 7
169 Golovanov399 7 7
172 zhouzhendongYa 4 4
173 ko_osaga 2 2
173 Sulfox 2 2
175 gamegame 1 1
175 rais.fathin38 1 1

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

During the past few days, we have done some internal optimizations (thanks, kuviman). Before the start of Codeforces Global Round 3, I want to be absolutely sure that everything works correctly. I ask you to help us to test the system. Please, take part in Testing Round 15 (Unrated). It is unrated, contains 1-2 easy well-known problems. The pretests will be extremely weak to increase the number of hacks. Thanks!

UPD: It seems everything works great. Thanks!

Full text and comments »

Announcement of Testing Round 15 (Unrated)
  • Vote: I like it
  • +36
  • Vote: I do not like it

By MikeMirzayanov, 6 years ago, translation, In English

Hello, Codeforces!

Today I’ve released an important update of the Polygon — partial support for advanced properties of resources. The main task that is being solved by this update is to support the development of problems with graders.

In most competitions, participants need to submit a complete solution code, including reading an input reading and an output writing. For example, in Codeforces rounds you solve such kind of problems. However, in some competitions another approach is using: a participant needs to implement the required function or interface.

For example, in a problem statement can be written that in a C ++ solution you need to implement a function that has prototype int sum (int a, int b) and submit the implementation. In this case, a participant has to submit a source code that contains the implementation of this function. Then, in the process of judging this solution for such a problem, an online judge should compile and link into a single executable file the file sent by the participant and a special jury-prepared file that contains the rest of the necessary code (in particular, there will be the function main).

In the case of problem ``A + B’’, such file, which is called a grader, might look like (grader.cpp):

#include <iostream>
int sum(int a, int b);
int main() {
	int a, b;
	std::cin >> a >> b;
	std::cout << sum(a, b) << std::endl;
}

A solution might look like:

int sum(int a, int b) {
    return a + b;
}

Therefore, a grader cannot be independently compiled into an executable file: it also needs a solution to the problem.

And now basic support for such problems in Polygon has been implemented (thanks to PavelKunyavskiy and cannor147 for the help!). I've started with C++ support only.

In order to add grader files, you must upload them as resources, specifying additional advanced properties: that resources are applicable to cpp.* language group, that they are compile-time resources and that solutions need to be compiled with them.

After adding such resources, while compiling solutions, they will be in the same folder with the solution, and those resources that are C++ files will be appended to the compiler command line.

Please note that all additional information for resources is available in the problem descriptor file problem.xml. Also, API is updated (see the documentation for the methods problem.files and problem.saveFile).

Later, the support of some other languages will be added. Also, I’ll add a feature to attach resources in a similar way not to solutions only, but also to validators/integrators/checkers. Of course, you can expect support for such kind of problems on Codeforces. I note that such problems can be used not only in olympiads/contests but also in the educational process. For example, I can easily imagine an exercise on Java, where you need to implement a given interface, and all other routines (unit tests and other things) are hidden in resources files.

P.S. The support of graders appeared for a special reason: today in Russia begins the IOI training camp. The best high school students will compete for the right to represent Russia on International Olympiad in Informatics. I hope, this feature will help the scientific committee to write new problems. And I wish participants every success and luck!

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Many thanks to problem authors — Tech Scouts instructors. Please, review the author's solutions. They are beautiful and short. Our community has many to learn from mathematicians!

Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

What do you know about real Mathforces? This is a world full of numbers, theorems and formulas. Are you ready for the adventure full of challenges and dangers in a new world?

Our friends from Harbour.Space University, the International Tournament of Young Mathematicians (ITYM) and St. Paul's International School Barcelona for the second time organize Tech Scouts — two week International summer camp for high school students. I really think it is a valuable and useful initiative.

For some participants the organizers cover participation fee, the decision is based on the results in special online math test and phone interview.

I invite you to take part in Mathforces: Tech Scouts Online Test 2018 (just fun and practice, unofficial, unrated). It was offered to candidates a year ago, in 2018. This year participants can use it as a practice. I think for many of you it will be interesting to compare your math skills. It starts on 05.05.2019 11:05 (Московское время).

The duration of the test will be 2 hours. You will be offered about 20 math questions. Each of them are expected to be solved using math skills. Please refrain from writing code and try to solve problems without any programming.

You can skip questions or re-submit answers during the test. All the answers will be judged after the test ends. Each question costs 1-3 points in case of the correct answer. Please, do not share your answers before the end of the test.

For sure, the test will be unrated.

Please refrain from participation if you have already participated in this test last year.

UPD 1: The problems will be in English.

UPD 2: The tutorials are published.

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Hello,

Three days ago I was forced to come back to ITMO (at midnight!) to turn on the server. I was just happy that the night security at the university understood everything and I got into the server room without any issues. It seems the server was overheated and and shut down. Today, I and cdkrot are planning to update a thermal grease in it. We have not done this before (but I watched the video on YouTube). Wish us good luck!

Full text and comments »

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

By MikeMirzayanov, history, 6 years ago, In English

Hi!

I didn't find any blog post about the round. So, let's discuss it. I'm a little bit upset, because I didn't solve C. Actually, on last minutes I wrote the solution which should pass if replace linear searches with binary.

Am I right that now Google doesn't publish tests?

P.S. And eatmore is right. The standings are completely unusable (

Full text and comments »

Tags gcj, 2019, 1b
  • Vote: I like it
  • +226
  • Vote: I do not like it

By MikeMirzayanov, 6 years ago, In English

ICPC World Finals 2019 will begin on April 4, 2019 at 11:00 (UTC). This event is the main event of the year in the world of sports programming!

In the past 20 years alone, ICPC participation has increased by more than 2000%. The contest evolved into its present form as a multi-tier competition in 1977, with the first finals held in conjunction with the ACM Computer Science Conference. Last year, ICPC Regional participation included 52,709 of the finest students and faculty in computing disciplines from 3,233 universities in 110 countries. We remind you that in the current world champion is the team of Moscow State University.

Codeforces wishes the teams to show a vivid and interesting contest. We wish to find beautiful solutions, write without bugs and enjoy many accepted problems!

Links:

ICPC World Finals 2019 English Broadcast:
Legends Live Stream (Endagorion + Petr + tourist):

Full text and comments »

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

By MikeMirzayanov, 6 years ago, translation, In English

Hi Codeforces!

Here are some recent improvements here and in Polygon.

Weak and Leaked Passwords

We often hear about password leaks from various services. Considering that having common passwords is a common (but insecure) practice, we've improved Codeforces and Polygon to identify weak or leaked passwords. If on the top of the website you see a message that your password is not secure, then just change it immediately.

Type of the round when creating a contest proposal

This item improves our work with the writers. When creating a contest proposal, please indicate the type of a round. Leave the field empty only if you don't know the type of the round (it is strange).

Calendar

We've fixed errors when synchronizing official Codeforces rounds with the calendar. Now everything should be correct.

I trust this user

Currently, Codeforces provides a mature infrastructure for organizing contests, olympiads and trainings. With the help of domain groups and mashups, competitions of various levels were hosted on Codeforces. The organizers are sometimes not regular users of Codeforces rounds and do not have rights to some of the actions. Now, any red user can confirm his trust in another account, and he will get the right to: write comments/posts, create private groups, create mashups. I hope this will save me from a certain routine of processing such requests.

Confirmation via email when entering Polygon

When you sign in Polygon, your IP-address and browser will be verified. If you didn't use them in the recent past, then you may be asked to sign in with a confirmation email. In this case, just follow the secret link that comes to your email.

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Thanks for taking part in the round. I hope you enjoyed the round. It happens that the statements were really easy to understand (thanks to testers). We've got only 38 questions during a round!

Tutorial is loading...
Code
Tutorial is loading...
Code
Tutorial is loading...
Code
Tutorial is loading...
Code
Tutorial is loading...
Code
Tutorial is loading...
Tutorial is loading...
Code
Tutorial is loading...
Code

Full text and comments »

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

By MikeMirzayanov, 6 years ago, translation, In English

Hello, Codeforces!

I am pleased to invite you to Codeforces Round 547 (Div. 3), which will start on Mar/19/2019 17:35 (Moscow time). Everyone whose current rating is strictly less than 1600 is invited to participate officially. All others can take part out of the competition.

It so happened that the schedule of this month is not replete with rounds (coordinators, we hope for you!). Therefore I decided to partially correct the situation. All the problems of this round were invented and prepared by me on the last day of Hello Muscat Programming Bootcamp 2019 and on flights from Muscat to St. Petersburg. I even specially noted the time for preparation: for the current moment (the problems are ready for testing) I spent about 6 hours on their preparation, including inventing some of the problems. I really like working on problems, this is something at the intersection of creativity and programming. I really hope you enjoy the result of my work.



I am in Oman while writing the problems for the round.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, during the round, solutions will be judged on preliminary tests, and after the round it will be a 12-hour phase of open hacks. I tried to make strong tests — just like you will be upset if many solutions fail after the contest is over. You will be given 6-8 problems for 2 hours to solve them.

Note that the penalty for incorrect submissions in this round is 10 minutes.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participants of the third division, you must:

  • take part in at least two rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

I hope a little later a list of thanks to testers will appear instead of this paragraph. So far I only plan to give the round to testing. Many thanks to the testers ivan100sic, KrK, Benq, I_love_Tanya_Romanova, nhho! UPD: And extra thanks to more testers Pavs, awoo, Narts, anon20016, Stresshoover, Ivan19981305.

Good luck on the round
MikeMirzayanov

Full text and comments »

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

By MikeMirzayanov, 6 years ago, translation, In English

Hello!

We supported the rendering of LaTeX-formulas with MathJax in new posts and comments. Now the formulas will be as beautiful as in problem statements. Drawback: they are displayed not immediately, but redrawn after the page is displayed. Old posts and comments are displayed in the old way (already a lot of old content, backward compatibility is very important). Note that if you edit old post, it will still be displayed in the old style.

Here are some example: $$$1 \le n \le 10^{12}$$$,  $$$c = \sqrt{a^2+b^2}$$$,  $$$i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$$$.

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Hey.

Last week I started the experiment.

I believe in semi-automated learning of programming through problem solving. There are clear advantages of this approach: independence of practice from the teacher, good testing of solutions, clear milestones for students, ability of the approach to scale.

The fundamentals of programming in this sense are quite good: it is easy to prepare problems, there is a clear learning plan, and student progress is well understood.

Surely some structured courses for learning the language from scratch already exist. But why not do it exactly the way I like it? IMHO, a set of problems is crucial here. The devil in the details: increase in the level of problems complexity, diversity, lack of requirements in mathematical preparation, and so on. I have teaching experience (OMG, almost 20 years!), some teaching materials from my work with students of Saratov University and the desire to try!

So, experiment. Since February 20, a wonderful girl le.mur has been learning the basics of C ++ from scratch under my supervision and guidance. We agreed that she captures her impressions in a special Instagram account (subscribe, it motivates!) Lena did not study mathematics in any special way, no initial skills in programming and informatics. Every day she practices 2-4 hours. I expect, one homework should be done in 1-4 days. My plan is to minimize individual explanations, as long as it turns out.



I brazenly stole a photo from Instagram

A training plan for the near future (that is, the very beginning) looks like this:

  • The concept of a variable, the simplest functions (min, max, abs), problems without conditional operators and loops.
  • Conditional operator, both forms (if, if-else). Understanding of scopes of variables, nested if-s. Problems on conditional operators.
  • Loop statements: while and for. Problems for the use of loops without additional constructions (that is, they are solved in one loop without nested conditionals/loops).
  • Problems to use loops and conditional operators together.
  • Problems to use nested loops.

Each item corresponds to one homework and it will contain 10-20 problems on this topic. Further according to the plan, arrays and strings are expected, but they have yet to be reached.

One of the first conclusions that I managed to do for myself: at the initial stage, you should not immerse yourself in unnecessary details, a simplified or incomplete understanding helps to understand the basics. For example, while Lena operates only with integer variables (type int), she always puts curly brackets after control operators, uses only logical && and ||, only approximately understands the meaning of the “using namespace std” magical spell. It seems to me that after obtaining the initial skills, it will be easier to expand understanding with types, additional operators and other details.

I hope that Lena will succeed and she will not lose her motivation to study.

And how did you learn the very basics of programming? What worked well for you?

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Hello, Codeforces!

Yesterday slappy advised me to stop writing problems. I will not listen to his advice and will not stop coming up with new problems. Moreover, the idea of problem 1118C - Palindromic Matrix is mine, and I do not consider it bad or unsuccessful.

IMHO, this is a good example of a problem, where an sloppy (almost slappy) implementation leads to a casework, duplication of code and a lot of formulas. On the other hand, a well-turned implementation is devoid of all these drawbacks and easy to write. It seems to me that such feedback about the problem is something of a Dunning-Kruger effect.

In general, this is an important skill of the developer to write such code, which solves the problem reliably, concisely and is not dirty. And if your code smells bad, then instead of the shaming the authors, I urge you to think "can I write a solution to this problem better?". Good way is to read solutions of other participants. You can choose short implementations from experienced participants. If you focus on learning, rather than just participating for fun, this should be the rule: read solutions of other participants (better experienced, choosing short codes or extremely efficient) and learn. The fact that you got “Accepted” does not mean that you have nothing to learn with this problem.

Here is the explanation of my solution which was written in ~10 minutes. Please, read the problem 1118C - Palindromic Matrix if you don’t know the statement. This problem is just a generalization of string palindrome constructing problem on 2D.

In general case there are 3 types of elements of a matrix (I didn’t spend to much time on drawing, the image is not perfect):

Each element in the blue area has 4 equal copies (itself and 3 additional symmetric cells). Each element in the yellow area has 2 equal copies (itself and 1 additional symmetric cell). And the single central cell (the green area) has only the single copy (itself). The yellow and green areas are absent in case of even n.

It means that you can fill the matrix with a greedy approach. At first process the blue area: for each cell take any value with number of occurrences at least 4 and fill the cell and its copies. After it process the yellow area (if any): for each cell take any value with number of occurrences at least 2 and fill the cell and its copy. Finally, process the green area (if any): take any value with number of occurrences at least 1 and fill the cell and its copy.

Easy to see that each time you can take a value with the greatest number of occurrences, so I used priority_queue<pair<int,int>> to maintain values ordered by number of occurrences. The first item in a pair is a number of occurrences, the second item in a pair is value itself. To construct such priority_queue q just use simple code like this:

map<int,int> cnts;
forn(i, n * n) {
    int val;
    cin >> val;
    cnts[val]++;
}
for (auto [key, value]: cnts)
    q.push({value, key});

To implement the rest of code, use simple function to reflect a position to the symmetric (in 1D):

int rev(int i) {
    return n - i - 1;
}

Now the main part of the code is: iterate over blue, yellow, green areas and put values in the matrix (consider all symmetric copies in together):

int m = n / 2;
forn(i, m) // blue area
    forn(j, m)
        put({{i, j}, {i, rev(j)}, {rev(i), j}, {rev(i), rev(j)}});
if (n % 2 != 0) {
    forn(i, m) { // yellow area
        put({{i, m}, {rev(i), m}});
        put({{m, i}, {m, rev(i)}});
    }
    put({{m, m}}); // green area
}

The function put takes a sequence of symmetric positions and put same values on them:

void put(vector<pair<int,int>> pos) {
    auto t(q.top());
    q.pop();
    if (t.first < pos.size()) // can’t do it?
        no(); 
    for (auto [i, j]: pos)
        a[i][j] = t.second;
    t.first -= pos.size();
    q.push(t);
}

So the complete code is very simple and contains only two if statements (almost no casework!).

Complete Code

MikeMirzayanov

Full text and comments »

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

By MikeMirzayanov, 6 years ago, translation, In English

Hi Codeforces!

February 2019 is already on the calendar, which means that I was late with the report for 2018. Better late than never! Let's remember last year.

In 2018, cdkrot, 300iq and arsijo joined the team of coordinators. The work of the coordinators is headed (and is the coordinator of the coordinators) KAN. I really hope that a more measured schedule of preparing rounds by a large team of coordinators will give a better insight into the contests. The main innovations in the platform are implemented by me and the developers kuviman, fcspartakm, MaximShipko. Great work on the organization of events and prizes mailing was done by gKseni.

Special thanks to the writers of the problems and testers. It is your content that charges the community with life and unites all of us. Thank you for the problems!

And now let's summarize the 2018th year.

Partner Events

We are pleased to hold programming competitions with companies or for companies. I'm sure this is a great way to support the community of young programmers and hire talented candidates. Here is a list of our main partners this year:

  • Telegram and personally Pavel Durov is supporting Codeforces activities for many years, every regular round is held with their help, thank you!
  • VK, VK Cup — team competition for young Russian-speaking programmers with a series of elimination rounds and finals in St. Petersburg
  • Mail.Ru, Mail.Ru Cup — open individual programming competition, consists of several stages, Technocup — open competition for schoolchildren
  • Harbour.Space University — a series of educational rounds, the selection of summer school Tech Scouts
  • Lyft — a two-level competition with the Final at Lyft headquarters (California) and the mirror contest for worldwide participants
  • Avito, Avito Code Challenge and Avito Cool Challenge — open partnership rounds targeting a wide international audience
  • Microsoft, Microsoft Q # Coding Contest — unusual quantum computing competition
  • AIM Tech — open partnership round targeting a wide international audience
  • Huawei — research competition (marathon) with elements of machine learning
  • IQ Option — private round as a corporate training

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Hello!

It is always satisfying and important for me when former contest participants offer their help to the community and support the development of programming competitions. And now I am in a hurry to share the news that thanks to the support of XTX Markets and the personal participation of Yuri Bedny and Alexander Gerko, we are launching a new line of Codeforces Global Rounds. Hooray!

Like many of you, I had never heard of XTX Markets before but it is one of the largest quantitative-driven electronic liquidity providers in the world. I understand little about the financial sector, but with their 34,148 cores and 42 petabytes of usable storage in their research cluster, XTX’s rapid growth and strong market share globally speak for themselves.

So, in 2019, with the support of XTX Markets, 6 rounds of the new Codeforces Global Rounds will be held. These will be common rounds for both divisions of 7–9 problems each. The duration of the rounds will be 2-3 hours, depending on the number and complexity of the problems. All such rounds will be rated for all participants. At each such round, 50 brand T-shirts will be handed out, and we will be happy to give T-shirts to all authors and problem testers.

I will be very happy for Codeforces to work with the best authors of the problems. I hope that the XTX Markets initiative will allow for interesting and testing rounds that will delight community members! We have the opportunity to pay $800, double fee, for the preparation of a full set of problems (for some rounds we may collect problems from different authors).

The first Global Round will take place very soon — starting Feb/07/2019 16:35 (Moscow time). I hope you will enjoy the round!

MikeMirzayanov

Full text and comments »

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

By MikeMirzayanov, 6 years ago, translation, In English

Hello!

The shortest news on Codeforces. I added support for Microsoft Visual Studio C ++ 2017. The solutions are compiled with the command line cl /std:c++17 /W4 /F268435456 /EHsc /O2 /DONLINE_JUDGE %1.

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Congratulations to all the new 2019 year! At this very moment you can make an important wish. Done? I wish it to be fulfilled!

I wish you to become better in the new year, to think better and to meet less often with bugs and mistakes. Let all your solutions be fast, effective and correct!

Later, I will compile statistics for 2018 and publish in the form of an annual report

Now I'd like to remind you most voted posts of 2018. Here is the list of the top 15:

Happy New Year!

Full text and comments »

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

By MikeMirzayanov, 6 years ago, In English

Do you already have a New Year's mood?

And we have traditional gifts!

Change Handle Feature

Hurry! Only until the 10th of January, you can change your handle (but only once)! Note that it will be possible to roll back the changes or change the handle again only after a year. Be careful what you wish for.

You can change your handle to the new one which wasn't used before by anybody or which was used by you before. The links to a profile page with old handle would automatically redirect to the actual profile.

This year we have an improvement. If you took part in at least 10 rounds you can request handle of an inactive participant. It means that the participant should have a period of activity on Codeforces of at most 90 days, this period should be in 2015 or earlier. The inactive participant can’t have posted comments, messages and so on. It can't take part in more than 2 contests. It will be automatically renamed and informed by email. If you can’t change handle to others, it means that some requirement doesn't meet. Please do not ask me to do something with it. I'm not Santa Claus.

Talking about handles I always reminisce the following story. Once a user wrote me the message: "Please change my handle from I_love_Valya to I_love_Sveta, as I no longer love Valya ..."

New Year's Masquerade of Colors and Ranks

Traditional magical tab has appeared in the profile setting. Happy New Year!

Full text and comments »

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