局部变量初始没有清空
一定要测试 g++ -O2 -Wall,一定要测试 g++ -O2 -Wall,一定要测试 g++ -O2 -Wall!!!
| vector<int> calc(int n) {
vector<int> res(n);
int sta[N], top;
int L = min(x0, x1), R = max(x0, x1);
res[x0] = 0, res[x1] = 1;
for(int i = L + 1; i <= R - 1; i++) sta[++top] = i;
for(int i = 2; i <= n - 1; i++) {
if(pos[i] == -1) res[sta[top--]] = i;
else {
res[pos[i]] = i;
if(pos[i] < L) {
for(int j = pos[i] + 1; j < L; j++) sta[++top] = j;
L = pos[i];
} else {
assert(pos[i] > R);
for(int j = R + 1; j < pos[i]; j++) sta[++top] = j;
R = pos[i];
}
}
}
return res;
}
|
警钟长鸣
\[
\text{D2T1}\quad 100pts\to 15pts\quad 140pts\to 55pts
\]