problem:- https://codeforces.com/contest/1692/problem/G
my submission:- https://codeforces.com/contest/1692/submission/168488617
# | User | Rating |
---|---|---|
1 | Benq | 3783 |
2 | jiangly | 3666 |
3 | tourist | 3611 |
4 | Um_nik | 3536 |
5 | inaFSTream | 3477 |
6 | fantasy | 3468 |
7 | maroonrk | 3464 |
8 | QAQAutoMaton | 3428 |
9 | ecnerwala | 3427 |
10 | Ormlis | 3396 |
# | User | Contrib. |
---|---|---|
1 | Um_nik | 185 |
2 | adamant | 178 |
3 | awoo | 177 |
4 | nor | 169 |
5 | maroonrk | 165 |
6 | -is-this-fft- | 164 |
7 | antontrygubO_o | 153 |
8 | ko_osaga | 151 |
9 | dario2994 | 150 |
10 | SecondThread | 149 |
problem:- https://codeforces.com/contest/1692/problem/G
my submission:- https://codeforces.com/contest/1692/submission/168488617
Name |
---|
Auto comment: topic has been updated by asaecs2 (previous revision, new revision, compare).
What should be the answer?
Shouldn't it be 3?
Sorry, I misunderstood your solution at first
answer is 0 but your code returns 1 because you increment ans if ct==k
thanks a lot man... I did find my mistake.
2 1 $$$\newline$$$ 2 1 $$$\newline$$$ at line 28 of your code, you wrote this : if (ct == k) ans++, ct--; $$$\newline$$$ In case of (k = 1) this will make ans = 1 before entering the loop, meanwhile , in this testcase, the answer is 0. $$$\newline$$$ I suggest doing this instead (at line 28) : $$$\newline$$$ if (k==1){ $$$\newline$$$ cout<<v.size()<<endl; $$$\newline$$$ return; $$$\newline$$$ } $$$\newline$$$
thnx bro... nice idea by the way