select two non overlapping segment such that sum of their length minimum. O(n) eg. [2,5], [4,6], [6,7]
ans-6 explanation 2 is overlapped with first and third but 1 and 3 is not ans-(5-2+1)+(7-6+1)=6 1<=n<=10^6 timeLimit-1 second
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3773 |
3 | Radewoosh | 3646 |
4 | ecnerwala | 3624 |
5 | jqdai0815 | 3620 |
5 | Benq | 3620 |
7 | orzdevinwang | 3612 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | cry | 161 |
2 | maomao90 | 160 |
3 | awoo | 159 |
4 | atcoder_official | 157 |
5 | -is-this-fft- | 155 |
5 | nor | 155 |
5 | adamant | 155 |
8 | maroonrk | 152 |
8 | Um_nik | 152 |
10 | Dominater069 | 147 |
select two non overlapping segment such that sum of their length minimum. O(n) eg. [2,5], [4,6], [6,7]
ans-6 explanation 2 is overlapped with first and third but 1 and 3 is not ans-(5-2+1)+(7-6+1)=6 1<=n<=10^6 timeLimit-1 second
has any GM or LGM develop some standard algorithm like-dijkstra or data structure like-fenwick tree or something?
How people generate large test case for hacking phase after contest?
Name |
---|