各位帮我看看嘛,全RE

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

凉介 @ 2021-10-13 20:30:50

#include<iostream>
using namespace std;
#define MAXSIZE 20001
struct gezi{
    int k;
};
struct bag{
    gezi a[MAXSIZE];
}b[MAXSIZE];
int main(){
   int n,m;
   cin>>n>>m;
    while(m--){
        int t,i,j;
        cin>>t;
        if(t==1){
            cin>>i>>j;
            cin>>b[i].a[j].k;
        }
        if(t==2){
            cin>>i>>j;
            cout<<b[i].a[j].k<<endl;
        }

    }
    return 0;
}

by _JY_ @ 2021-10-13 20:33:10

试下map/vector?


by huwanpeng @ 2021-10-13 20:35:11

@凉介

 a[i]<=10^5

开20001哪里够啊


by hopeless_hope @ 2021-10-13 20:36:22

@凉介 数组小了,#define MAXSIZE 100001


by Avocadooo @ 2021-10-13 20:41:23

@cyc0916 数组开不了这么大,因为总共最多只有 10^7 个,开个STD的vector就行了


by 凉介 @ 2021-10-13 20:43:11

@IX 好吧谢谢啦


by 凉介 @ 2021-10-13 20:43:43

@乔木生夏凉 好吧谢谢啦


|