为什么这个RE了

P3613 【深基15.例2】寄包柜

Tipsy_bamboo @ 2021-03-03 19:38:32

#include<bits/stdc++.h>
using namespace std;
class Dm
{
    public:
        long long gs, bg[100005][100005], cs, lx, guz, gez, dx, i;
        void sr()
        {
            cin >> gs >> cs;
        }
        void cz1()
        {
            bg[guz][gez] = dx;
            cout << bg[guz][gez] << endl; 
        }
        void cz2()
        {
            cout << bg[guz][gez] << endl;
        }
        void zt()
        {
            for(i = 1; i <= cs; i++)
            {
                cin >> lx >> guz >> gez;
                if(lx == 1)
                {
                    cin >> dx;
                    cz1();
                }
                else cz2();
            }
        }
};
int main()
{
    Dm dm;
    dm.sr();
    dm.zt();
    return 0;
}

by CGDGAD @ 2021-03-03 19:41:11

数组开小点


by MSqwq @ 2021-03-03 19:53:08

@chenqiutong1127 数组大了


by Tipsy_bamboo @ 2021-03-03 20:09:56

@NSObject
谢谢


by Tipsy_bamboo @ 2021-03-03 20:11:22

@My_sort 谢谢,可是数组开小了后,不会不够吗?
题目的要求是10的5次方等于100000


by CGDGAD @ 2021-03-03 20:38:13

@chenqiutong1127 所以您的做法不是很优的,可以看一下题解


by Tipsy_bamboo @ 2021-03-03 20:51:32

@NSObject
好的,谢谢提醒


|