At last!
The problem is 65A - Harry Potter and Three Spells, if you're curious.
Apparently, thinking before coding helps.
What is the longest it took you to upsolve a problem?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3741 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3489 |
7 | Radewoosh | 3483 |
8 | Kevin114514 | 3443 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | atcoder_official | 162 |
3 | maomao90 | 162 |
5 | adamant | 158 |
5 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
8 | djm03178 | 154 |
10 | Dominater069 | 153 |
At last!
The problem is 65A - Harry Potter and Three Spells, if you're curious.
Apparently, thinking before coding helps.
What is the longest it took you to upsolve a problem?
I've bumped into this blog post by imtiyazrasool92 (unfortunately, it's already deleted due to downvotes). They've found out that simply declaring a global variable called read
makes your program behave strangely on Codeforces: the outcome of 130645392 is RUNTIME_ERROR
, Exit code is 2147483647
, and here is the code:
#include <iostream>
int read;
int main(){
std::ios_base::sync_with_stdio(false);
std::cin >> read;
}
I was unable to minimize the example any further.
The original post was even more interesting: 130642683 is Accepted, but 130643108 is Runtime Error all of a sudden.
The compiler on Codeforces is G++17 9.2.0 (64 bit, msys2)
. However, I was able to reproduce the issue both on my local machine (g++ (Rev2, Built by MSYS2 project) 10.3.0
) and the latest GCC on Godbolt as long as the -static
key is used for compilation just like on Codeforces. Clang is also affected.
It looks like the read
variable here replaces the standard Linux read
function (which is emulated by msys2). Here is a symmetrical example:
#include <iostream>
int write;
int main(){
std::ios_base::sync_with_stdio(false);
std::cout << 10;
}
And here is one more (130646314), although now I at least get some warnings:
int malloc;
int main(){
}
a.cpp:1:5: warning: built-in function 'malloc' declared as non-function [-Wbuiltin-declaration-mismatch]
1 | int malloc;
| ^~~~~~
My understanding is that all these examples invoke ODR violation, which makes the program ill-formed (invalid) without any requirements on the compiler to emit the error. However, I am not sure, so I asked on StackOverflow.
Any other ideas?
Hi everyone!
I'd like to present you a prototype of Visual Studio plugin which was developed by a student from my university as a coursework. Yielding floor to her:
GraphAlgorithmRenderer is an experimental Visual Studio extension for debugging and visualizing graph algorithms. It takes a description of graph nodes, edges and their properties, such as color and label, and renders a corresponding graph. The graph is refreshed automatically when you step in debugger. Graph config can be serialized to JSON and deserialized back.
In the last few weeks or even months I've noticed that my use scenario for Codeforces became broken. Here it is:
The problem is: approximately half of 5-10 opened tabs is rendered empty. Empty in the following sense: there is tab's title, one can see source HTML (e.g. the page is loaded), but the page itself is completely blank. DOM tree contains something (not too much), but <body>
's height is zero:
For comparison, here is the same page, rendered correctly (note that now we have several new scripts and a <div id="body">
):
Steps to reproduce:
firefox -P -no-remote
and create a new profile; this guarantees no strange cookies on external websites). However, I was unable to reproduce the problem in "Private Browsing".I suspect that this is caused by some cookies set by either Codeforces or its analytics/like scripts (e.g. VK/Facebook).
Hello everyone.
Is there anybody who interviewed/interned/worked at Samsung (Seoul or any other office) for software engineering-related positions? I think it's more probable to find such people among All-Siberian Open Olympiad in Programming participants, as Samsung sponsored it for some time.
If there is, would you mind sharing your experience or thoughts? Extra bonus points if you compare it with your European/American experience.
Hello everyone.
Two years ago there was a post titled "Submitting IOI problems" and my comment there. I offered everyone to contact me via PM on Codeforces to get the access and be able to solve problems from past IOIs (starting with IOI 2003). What was important here is that PavelKunyavskiy and me took effort and made the system as similar to what was used on particular IOI as we could, including:
So far it was a closed judge available upon request only. As far as I remember, I've granted access to everyone who've asked — 150+ persons. Time flows and the judge eventually migrated to Yandex.Contest (the system used for Yandex.Algorithm) with help of lperovskaya. It still supports all of the above, but the registration is open for everyone and IOI 2015 is available there. Feel free to join!
Unfortunately, it's still a beta version and there are still some issues: no problem statements are visible in the interface, some labels may be in Russian only and graders for Pascal and Java may be non-working in some problems (C++ should work everywhere, though). Note that we use slightly different conventions for graders from what was on IOI (for the sake of consistency among all IOIs). You can download an archive with example solutions by clicking on the "Download" button right to the "Jury messages" link. If the button is not here, there is no archive with example solutions yet, but the format of graders should be very similar among all problems and we didn't change signatures of functions from IOI, so it should be fairly easy to "restore" the format.
I hope that will help all of you who are preparing for upcoming IOIs! By the way, if you have not advanced to IOI this year, I would highly recommend you to avoid reading several IOIs so you will have good problems preparing for IOI next year. It's hard to find good IOI-like problems.
I've just discovered this question on Quora: What is the story behind your username at CodeForces?. I guess it'd be pretty interesting to hear stories from top participants. For instance, my handle's history is already described there.
This blog is dedicated to everyone who don't have Quora account, so you can share your histories and comments here.
I personally would love to hear stories from tourist, rng_58 and YuukaKazami from current top-10.
Hello everyone.
Right now I'm settings up APIO 2011 contest for training purposes. It seems to me like test data (answers, to be precise) in problems 'Guess My Word' and 'Table Coloring' are broken. I have three solutions from three different people for the latter problem and they produce the same answers for tests 10, 12, 14, 16 and 18 — zero, while the reference answer is non-zero. For the 'Guess my Word' problem I have two solutions: one fast and one brute-force with memoization which I wrote by myself several minutes ago. These two solutions produce same output on tests 1-16, but they both produce 'No' on some test cases where official test data says 'Yes'.
Does anyone have information about validity of this test data or some solutions which I can test with too?
Thank you.
Everyone knows a problem with native executables on Windows: if it tries to allocate very large static arrays (or something similar that causes problems during the loading), then the testing system may mark the submission as 'it killed our system' and report nothing to the participant. Say, in Testsys it caused Failed To Test (and no feedback to the participant), on Codeforces it caused Denial of Judgement, and PCMS2 still has this problem. Example submission:
int data[(int)2.1e9 / sizeof(int)];
main() {}
If one is familiar with process creation on Windows, it's obvious what to do: try to run the solution right after compilation and report Compilation Error with report in case of invalid executable. It looks like noone except me have the time to do this and here is my utility, which already serves on Codeforces. If you have your own testing system, you're welcome to run this application after compilation to check an executable for validness (you can just copy-paste the code directly into your judging module, too). After that you will be able to report incidents to the user and drop hints about extra large arrays existance.
No user code is being running during the check: process is fully suspended by the OS after successfull loading and before any instructions are run (it's what the CREATE_SUSPENDED
parameter is responsible for).
Does anyone know when the results of APIO 2012 will appear? Results of open contest were published several days ago, test data is available for two days already, but results are still 'TBA'.
You can install it here. If the only thing you see is javascript code it means that your browser doesn't support userscripts
You can report bugs, ideas and suggestions here.
UPD: now you can view parent comment if you hover over the "^" link. This link still works.
UPD2: repository on GitHub is available.
You can either check all four cases or notice, that if we consider front/back equal to 0/1 (b) and decrease a by 1, then a XOR b became the answer (0/1). Time and memory consumption - O(1).
Just write one loop: while kth question has already been asked, increase k by one and if k > n let k = 1. Time and memory consumpiton - O(n).
One of the possible solutions is direct emulation. Winnie won't do more than 3n iterations (because he can use each jar more than three times). You can emulate each iteration in O(n) (just find maximum in array). Summary time - O(n2) ≈ 104 operations, memory consumption - O(n)
There is another shorter solution: let's notice that order of jars doesn't matter. Let's see how much honey from each jar will be eaten by Winnie and how much will be left to Piglet. If ai ≥ 3k then Winnie will leave ai - 3k kg of honey to Piglet. If ai < 3k then he'll leave only kg. Now solution is one loop. Time and memory consumption is O(n).
Name |
---|