对于如下数据,是不是可以卡到 O(n2q)?
4
RRRD 1
RRRD 2
RRRD 3
RRRD 4
1 2 3 4
10
4 4
4 4
4 4
4 4
gen.cpp:
n = 5000,q = 100000;
cout << n << endl;
for (int i = 1;i <= n;i++) {
for (int j = 1;j < n;j++) cout << 'R';
cout << 'D';
cout << ' ' << rand () << endl;
}
cout << q << endl;
while (q--) {
cout << n << ' ' << n << endl;
}
有无大佬给出正确做法的代码 /kel