CVOTE - Editorial

Yes, exactly. But try to output array after unique to make sure that I’m right.

Yes, you were right. Thanks. Nothing else beats the joy of learning something new everyday.

lower_bound behaves like binary search and has complexity O(log N).
O(N) equivalent for basic types is

```
lower_bound(int* L, int* R, int val) {
    int* i = L;
    for (; i < R && *i < val; ++i);
    return i;
}
```

It works correctly only if array is sorted.

Refer to this for exact equivalent raw code:
http://www.cplusplus.com/reference/algorithm/lower_bound/

Will you please refer me to any book or online stuff where I can learn more about STL and functions common in practice in C++, along with their explanations?

http://www.cplusplus.com/reference

Actually I always google function_name C++ reference and appear on the corresponding page at this site.

Thanks Anton, you are the man. One ctrl+z wreaked havoc for me :frowning:

Please indent your code properly. It is very hard to follow it.

Also I see some double loops like for each vote you traverse the list of all chefs to find the proper one.

Such solution will get TLE after you fix the bug that leads to WA.

Which compiler?

Can someone pls explain me if ‘India’ is greater or ‘Indiaa’ ? And how to handle this case using compareTo function?

Why i am getting a WA . Please help. @anton_lunyo

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

https://www.codechef.com/viewsolution/37024292

Can Anyone Have time to review my submission and tell me where My solution gets wrong? Pleaseeeeeeeeeeee

Consider the test input:

3 4
NDCJefb BAbAbBbbAA
aa Aba
hFMAFOdi GgAdLA
NDCJefb
aa
hFMAFOdi
NDCJefb
2 Likes

Thanks for your time.
I understood what i am missing.

1 Like