帮忙看一眼RE?

P1563 [NOIP2016 提高组] 玩具谜题

。。。 以后仔细点 ```cpp #include <iostream> #include <string> #include <algorithm> #define maxn 100005 int lr[maxn], c[maxn], d[maxn], num = 1, sum = -1; char name[maxn][15];//char name[maxn][maxn];这里后面一个大小开错了,这就解释了你为什么数组开大反而RE得多,空间爆了 using namespace std; int main() { int n, m, a, s; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> lr[i] >> name[i]; } for (int i = 1; i <= m; i++) { cin >> a >> s; if (lr[num] == 0) { if (a == 0) { num -= s; } else num += s; } else { if (a == 0) { num += s; } else num -= s; } while (num > n) num -= n; while (num <= 0) num += n;//这里可以不改,写while安全一点,不改也没关系 } cout << name[num]<<endl; } ``` 来自一位初二Oler
by pp_orange @ 2022-01-24 21:10:16


https://www.luogu.com.cn/record/67815157 我AC的链接
by pp_orange @ 2022-01-24 21:11:01


@[汝甚骚](/user/224443) 初二的Oler是吧,orz哈哈哈
by 画船听雨 @ 2022-01-24 22:47:09


AC了,不仅是二维开大了,而且maxn开小了。。。
by __Cow__ @ 2022-01-25 10:19:56


|