https://codeforces.me/contest/1366/submission/83422255 In today's contest i was trying to solve a problem and i got re. Can anyone explain why?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
https://codeforces.me/contest/1366/submission/83422255 In today's contest i was trying to solve a problem and i got re. Can anyone explain why?
Название |
---|
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!