求各位专业人士帮我看看为什么我只得30分

P3960 [NOIP2017 提高组] 列队

```cpp #include <iostream> using namespace std; long long hang, lie, thing, ren[10000][10000], wei_hang[10000], wei_lie[10000], start = 0, leave, result[10000], count = 0; void input(const long long &hang,const long long &lie,const long long &thing); void move(const long long &hang, const long long &lie); void left(const long long &hang, const long long &lie); void go(const long long &hang, const long long &lie); int main() { freopen("phalanx.in", "r", stdin); freopen("phalanx.out", "w", stdout); cin >> hang >> lie >> thing; input(hang, lie, thing); for (int m = 1; m <=thing;++m) { move(wei_hang[m], wei_lie[m]); result[++count] = leave; left(hang, lie); go(hang, lie); ren[hang][lie] = leave; } for (int d = 1; d <= thing;++d) { cout << result[d] << endl; } fclose(stdin); fclose(stdout); return 0; } void input(const long long &hang, const long long &lie, const long long &thing) { for (int i = 1; i <= thing;++i) { cin >> wei_hang[i] >> wei_lie[i]; } for (int h = 1; h <= hang;++h) { for (int l = 1; l <= lie;++l) { ren[h][l] = ++start; } } } void move(const long long &hang,const long long &lie) { leave = ren[hang][lie]; ren[hang][lie] = 0; } void left(const long long &hang,const long long &lie) { for (int h = 1; h <= hang;++h) { for (int l = 1; l <= lie;++l) { if(!ren[h][l]) { if(l!=lie) { long long s = l + 1; ren[h][l] = ren[h][s]; ren[h][s] = 0; } } } } } void go(const long long &hang,const long long &lie) { for (int h = 1; h <= hang;++h) { if(!ren[h][lie]) { if(h!=hang) { long long s = h + 1; ren[h][lie] = ren[s][lie]; ren[s][lie] = 0; } } } } ```
by Big_Kiwi_Fruit @ 2018-11-05 13:29:31


我自己手动测试多组数据,发现答案都是准确无误,但是还是只得三十分,求各位专业人士解答 感激不尽
by Big_Kiwi_Fruit @ 2018-11-05 13:31:51


@[Big_Kiwi_Fruit](/space/show?uid=144911) 您的暴力本来就只有 $30$ 分啊。 另外,我不是专业人士。
by hellomath @ 2018-11-05 13:38:19


@[larryzhong](/space/show?uid=20438) 那主要是错在哪里? 求解释。如果解决?
by Big_Kiwi_Fruit @ 2018-11-05 13:54:30


@[Big_Kiwi_Fruit](/space/show?uid=144911) 不是您看看复杂度啊,这种复杂度怎么可能过得去啊
by Marser @ 2018-11-05 14:43:41


空间$O(nm)$,时间$O(q(n+m))$,怎么可能不炸
by daifucong @ 2018-11-09 08:08:31


|