这题为什么我全是re?

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

0kdt_BT @ 2020-04-03 16:11:09

#include<iostream>
const long long MAXSIZE=1e+9;
const long long  MAX=1E+5;
using namespace std;
typedef struct BOX{
    long long things[MAXSIZE];
}box;

int main(void){
    int num;
    long long count;
    cin>>num>>count;
    box Box[MAX]={0};
    int flag,a;
    long long b;
    for(int i=1;i<=count;i++){
        cin>>flag>>a>>b;
        if(flag==1){
            long long tmp;
            cin>>tmp;
            if(tmp==0)
                Box[a].things[b]=0;
            else 
                Box[a].things[b]=tmp;
        }
        else if(flag==2){
            cout<<Box[a].things[b]<<endl;
        }
    }
    return 0;
}

by Marser @ 2020-04-03 16:22:43

@Soulmate_1437 map学过吗?


by 0kdt_BT @ 2020-04-03 16:23:43


by HearTheWindSing @ 2020-04-03 16:24:00

话说这题我用了1e5个map


by Marser @ 2020-04-03 16:24:01

@Soulmate_1437 除了这两个没得做了


by Warriors_Cat @ 2020-04-03 16:24:11

那就先别做这道题吧


by HearTheWindSing @ 2020-04-03 16:24:23

@Soulmate_1437 总之你要动态分配内存


by 0kdt_BT @ 2020-04-03 16:25:21

哦哦,明白了


by FCBM71 @ 2020-04-03 16:55:50

@Marser 这份代码预计空间开销800TB


by XyzL @ 2020-04-03 17:30:25

这头像...


by __gcd @ 2020-04-03 18:01:34

@杨氏之子 @Xyzl 这头像有什么问题吗??


上一页 | 下一页