| # | User | Rating |
|---|---|---|
| 1 | Benq | 3857 |
| 2 | jiangly | 3810 |
| 3 | maroonrk | 3534 |
| 4 | tourist | 3528 |
| 5 | Kevin114514 | 3510 |
| 6 | turmax | 3411 |
| 7 | Um_nik | 3387 |
| 8 | Radewoosh | 3367 |
| 9 | heuristica | 3322 |
| 10 | strapple | 3317 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | maspy | 150 |
| 3 | Um_nik | 146 |
| 4 | Errichto | 139 |
| 5 | adamant | 136 |
| 6 | maroonrk | 134 |
| 7 | DNR | 133 |
| 8 | Dominater069 | 131 |
| 9 | Proof_by_QED | 130 |
| 9 | AmShZ | 130 |
|
0
I was thinking of another approach. After we have constructed the graph formed by edges which belong to a shortest path from 1 to n, we can find the bridges of this newly formed graph. And, these bridges will be the answer to given problem. Can you please check if my method is correct or not ? Thanks |
|
+4
There is a mistake in the last line, it should be best_i + sum(i+1,i+len) — k (it is written correctly in the sample code). As for the reasoning, Suppose you want to find score of array of length len starting at index, then let rem=len%m. The your score would be sum(i,i+rem-1) -k + max(i+rem). where max(i+rem) is the maximum score you can obtain if you are starting at index (i+rem) and your sub-array's length is multiple of m (i.e. m, 2m, 3m...) Now, you can notice that max[i] = sum(i,i+m-1) + max[i+m]. Your base case would be max[n-m]= MAX(0, sum(n-m,n-1)], and max[i]=0 for all i greater than n-m and less than n-1. After your max array is calculated you can go through all the indices and for each rem = 1,2,3....m, find out the maximum score. |
|
+29
Team : Ctrl Shift Defeat from IIT Kanpur Members : SanathSalampuria 431jericho Kev2103 Regionals : Qualified for Kanpur and Chennai Rivals : up and coming team 'segment_trACk' from IIT Kanpur Preferences in problemset : 1900 and below problems, NO DP |
|
0
Thanks a lot |
|
0
Subject: Need Help for G2 In tutorial it is said we will need to do BS over all the values by taking it as our first problem. While solving I thought that if we took min out of all the starting costs it would be enough. In case of equality between 2 such values I took the one with greater cost from back. It is showing WA at test case 828 expected 2 output 1; what is wrong in my reasoning ? |
| Name |
|---|


