Здравствуйте, сегодня в 5:00 по московскому времени начался очередной SRM, предлагаю после окончания соревнования вести его обсуждение здесь.
# | User | Rating |
---|---|---|
1 | tourist | 3803 |
2 | jiangly | 3707 |
3 | Benq | 3627 |
4 | ecnerwala | 3584 |
5 | orzdevinwang | 3573 |
6 | Geothermal | 3569 |
6 | cnnfls_csy | 3569 |
8 | Radewoosh | 3542 |
9 | jqdai0815 | 3532 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | awoo | 163 |
2 | maomao90 | 160 |
3 | adamant | 159 |
4 | maroonrk | 152 |
5 | -is-this-fft- | 150 |
6 | atcoder_official | 148 |
6 | SecondThread | 148 |
8 | nor | 147 |
9 | TheScrasse | 146 |
10 | Petr | 144 |
![]() Gentleman
|
13 years ago,
#
|
![]() ![]() How to solve the problem 500 (Div 2) ?
→
Reply
|
![]() 1a1a1a
|
13 years ago,
#
^
|
←
Rev. 2
→
![]() ![]() 1 . pre calculate the amount of lucky numbers on segment [0,N]. (you can do this using dp approach). Code will look like this int cnt[4747+1] = {0}; for(int x = 1; x <= 4747; ++x) cnt[x] = cnt[x-1] + isLucky(x); 2. in order to obtain the amount of lucky numbers on arbitrary segment you can use cnt array. number of lucky numbers on segment[M,N] equals to cnt[N] - cnt[N-1]. 3. to solve problem just simulate the game int ans = 0; for(int aa = a; aa + jLen - 1 <= b; ++aa) { int brus = bLen; for(int bb = aa; bb + bLen - 1<= aa + jLen - 1; ++bb) { brus = min(brus, cnt[bb + bLen - 1] - cnt[bb-1] ); } ans = max(ans, brus); } return ans;
→
Reply
|
Name |
---|