https://mirror.codeforces.com/contest/1366/submission/83422255 In today's contest i was trying to solve a problem and i got re. Can anyone explain why?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
https://mirror.codeforces.com/contest/1366/submission/83422255 In today's contest i was trying to solve a problem and i got re. Can anyone explain why?
Name |
---|
It is really obvious from your memory consumption. It is a stack overflow. Imagine how many recursive calls you will do? Don't you think it is too much? I will give you a hint:
Imagine a stick is $$$X$$$ and a diamond is $$$Y$$$. You will need to minimize the sum of $$$X$$$ and $$$Y$$$ after you simultaneous subtract them. There are two methods of subtraction which will give you an emerald:
$$$X=X-1$$$,$$$Y=Y-2$$$
or
$$$X=X-2$$$,$$$Y=Y-1$$$
thanks
You're welcome!