hello, I got stuck in this problem can any one help me in figuring out what is the mistake. submission link:- https://codeforces.net/contest/1790/submission/296512970
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3885 |
3 | jqdai0815 | 3682 |
4 | Benq | 3580 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3506 |
7 | ecnerwala | 3505 |
8 | Radewoosh | 3457 |
9 | Kevin114514 | 3377 |
10 | gamegame | 3374 |
# | User | Contrib. |
---|---|---|
1 | cry | 170 |
2 | Um_nik | 162 |
3 | atcoder_official | 161 |
4 | maomao90 | 159 |
5 | -is-this-fft- | 158 |
6 | djm03178 | 157 |
7 | Dominater069 | 155 |
8 | adamant | 154 |
9 | luogu_official | 153 |
10 | awoo | 152 |
hello, I got stuck in this problem can any one help me in figuring out what is the mistake. submission link:- https://codeforces.net/contest/1790/submission/296512970
Name |
---|
People could figure out your mistake better if you explain your approach
Hewwo ╰(*°▽°*)╯
actually in the question they mentioned that we can keep consecutive integers of the array in one set and we have to return what is the number of such sets that can be formed. for that I took a variable temp to check for consecutive that is (x.F-temp==1) then if x.S!=0&&(x.F-temp==1)-----> true then I continued for the nexts consecutives with temp=x.F and m[x.F]--; if at some value x.S!=0&&(x.F-temp!=1)-----> true then I only continued with temp=x.F; for further consecutive. all the left values or the value which are not consecutive they will get deduced in the first case where y==0 is mentioned
then when all the values of the map is 0 the I break. however the solution is O(n^2) may be.....
Your code outputs 2 whereas we cannot form less than 3 sets.
yes thank you sir. for your help. now I can figure out the problem.
thank you sir for your time.