Loading docs/intro/common-mistakes.md +3 −3 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ - 读入优化未判断负数。 - 数据类型不够大导致溢出,即常见的不开`long long`见祖宗 - 所用数据类型不够大导致溢出,即常见的不开 `long long` 见祖宗 - 存图下标从 0 开始输入节点未 -1。 Loading Loading @@ -97,7 +97,7 @@ - `freopen()` 中的文件名未加 `.in` / `.out` 。 - 排序时比较函数的错误 `std::sort`要求比较函数是严格弱序:`a<a`为`false`,若`a<b`为`true`则`b<a`为`false`,若`a<b`为`true`且`b<c`为`true`则`a<c`为`true`。其中要特别注意第二点。 `std::sort` 要求比较函数是严格弱序:`a<a` 为 `false`;若 `a<b` 为 `true`,则 `b<a` 为 `false`;若 `a<b` 为 `true` 且 `b<c` 为 `true`,则 `a<c` 为 `true`。其中要特别注意第二点。 如果不满足上述要求,排序时很可能会 RE。 Loading Loading
docs/intro/common-mistakes.md +3 −3 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ - 读入优化未判断负数。 - 数据类型不够大导致溢出,即常见的不开`long long`见祖宗 - 所用数据类型不够大导致溢出,即常见的不开 `long long` 见祖宗 - 存图下标从 0 开始输入节点未 -1。 Loading Loading @@ -97,7 +97,7 @@ - `freopen()` 中的文件名未加 `.in` / `.out` 。 - 排序时比较函数的错误 `std::sort`要求比较函数是严格弱序:`a<a`为`false`,若`a<b`为`true`则`b<a`为`false`,若`a<b`为`true`且`b<c`为`true`则`a<c`为`true`。其中要特别注意第二点。 `std::sort` 要求比较函数是严格弱序:`a<a` 为 `false`;若 `a<b` 为 `true`,则 `b<a` 为 `false`;若 `a<b` 为 `true` 且 `b<c` 为 `true`,则 `a<c` 为 `true`。其中要特别注意第二点。 如果不满足上述要求,排序时很可能会 RE。 Loading