# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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! :)