# | User | Rating |
---|---|---|
1 | ecnerwala | 3649 |
2 | Benq | 3581 |
3 | orzdevinwang | 3570 |
4 | Geothermal | 3569 |
4 | cnnfls_csy | 3569 |
6 | tourist | 3565 |
7 | maroonrk | 3531 |
8 | Radewoosh | 3521 |
9 | Um_nik | 3482 |
10 | jiangly | 3468 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 164 |
3 | adamant | 162 |
4 | TheScrasse | 159 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 151 |
8 | SecondThread | 147 |
9 | orz | 146 |
10 | pajenegod | 145 |
Name |
---|
I don't know, how it can be compiled, but it is wrong:
Use vector instead:
Can you tell me why !? you say that therse is'nt array of strings !?
is array, but according C++ standard, array's length must be constant, which is known at compile-time. In your case n is unknown at compile-time, so it is undefined behaviour.
It’s not undefined behaviour. According to the standard, the program is invalid, and a strictly conforming compiler will reject it, i. e. refuse to compile. However, in practice compilers support this as a language extension.
Note that variable length arrays are perfectly valid in C since C99.
Another bug:
1) Use "return a < b;" in cmp function 2) And use
Instead
Accepted! big thanks! :)
But I don't understand what is difference of them !
There is no problem in
here's everything ok. :)
The potential problem is in
because sort and other functions from
<algorithm>
header expect strict predicate ( less , not lessOrEqual). In some compilers, using lessOrEqual can bring to runtime-assert-check. For example:Gives debug-assert in MSVS 2010:
But it's not critical for problem acceptance on contest (because problem runs not in debug config), it's right way to make reliable software. :)
I understand! thanks! :)