狠狠撸
Submit Search
AtCoder Regular Contest 028 解説
?
2 likes
?
5,794 views
A
AtCoder Inc.
Follow
AtCoder Regular Contest 028 解説
Read less
Read more
1 of 20
Download now
Downloaded 27 times
More Related Content
AtCoder Regular Contest 028 解説
1.
A?? ?▼??????
2.
???せ ? ??N???▼???????
? Ant???Bug???Ant??...???????????? ? Ant???A????Bug???B????▼???? ? ?????????????????????? ? ?? ? 1 ≤ N, A, B ≤ 1000
3.
ゎ? ? ??????????????
? ????????????????A?B????? ????? ? ?????0?????????????????? ????????
4.
B?? ???
5.
???せ ? ??????????N?????????
? i?????????????┠???????? ??? ? 1??j??????K?┠?????????K~N ?j????????? ? ?? ? 1 ≤ N ≤ 10^5
6.
40?ゎ? (N≤1000) ?
?????????????? ? 1???j???????????????K?┠?せ ??ぢ??
7.
??ゎ? ? j???????????????????????
???? ? ?????K+1?┠?????????????K ?┠???????? ? ????????? – K+1?┠????????????? – K?┠???????⿵?????⿵???????? ??????⿵??????? ? ???⿵????????????????????
8.
??ゎ? ? ??????????????????せ??せ
????? – せ?????? – せ??????????????? ? priority queue???????queue? ? ????O(log せ??)??????????? ? ゝㄒ????????????????????? ????????
9.
C?? ?????????
10.
???せ ? ???N?????????
? ??v???????????????????? ??????????v???????? ? ?? ? 1 ≤ N ≤ 10^5
11.
30?ゎ? (N≤1000) ?
?????????????? ? ?????????????? ? DFS?????????
12.
??ゎ? ? ????????????????
? DFS?????DP??????????????? ???????????? ? ????ぶ?????????????????? ???? ? →N-?‐1-?‐(?????????????) ???????
13.
??? ? ヲ??????┬?????
? ?????????????????????? ????????????????
14.
D?? ?????????
15.
???せ ? N??????????A[i]????
? ?k??┠????x???????ィM????? ???????????????????Q????? ? ?? ? 1 ≤ N ≤ 2000 ? 1 ≤ M ≤ 2000 ? 1 ≤ Q ≤ 500000
16.
10?ゎ? (N,M,Q≤100) ?
?????????DP???? ? DP[i][j]=i??┠???j???????? ? ???? ? DP[i][j] = ΣDP[i-?‐1][j-?‐a[i]]~DP[i-?‐1][j] ? ??????????O(1)???????
17.
30?ゎ? (N,M≤100) ?
???????????????????? ? ??i???????????DP????????? ????????i?????????? ? ????O(N^2M) ? ?????O(M) ? ????30???????????
18.
80?ゎ?(N,M≤2000,Q≤1000) ? ?i???????DP???┤??????↓???
? ? 0~j?????????DP????? ? j~N?????????DP???? ? ???????(せ?????????DP????) ? ???????????DP????????????? O(M)??????????????
19.
??ゎ? ? ?????O(1)????????????
? ??i???????????DP????????? ????????i???????????? ? ?? ? ??????????? ? DP?????DP[i-?‐1]????(??)????
20.
??DP ? DP[i]??DP[i-?‐1]??????
? DP[i][j] = ΣDP[i-?‐1][j-?‐a[i]]~DP[i-?‐1][j] ? → ? DP[i-?‐1][j] = DP[i][j]-?‐ΣDP[i-?‐1][j-?‐a[i]]~DP[i-?‐1][j-?‐1] ? O(M)??????? ? ????????????????????? DP[N]??????i???????????DP??? ????i???????????
Download