罗非鱼Requiem @ 2021-08-19 20:52:38
以下是代码(C++):
#include <bits/stdc++.h>
using namespace std;
int a_n[10000][10000];
int main() {
int n, q;
cin >> n >> q;
for(int i=0;i<q;i++) {
int a1, a2, a3, a4;
cin >> a1 >> a2 >> a3;
if(a1==1) {
cin >> a4;
if(a4==0)
a_n[a2][a3] = -1;
else
a_n[a2][a3] = a4;
}
else
cout << a_n[a2][a3] << endl;
}
return 0;
}
by 罗非鱼Requiem @ 2021-08-20 10:08:29
@kkksc0100_juruo 谢谢,意思是我要优化算法? 谢谢
by Union_of_Britain @ 2021-08-20 10:09:42
@罗非鱼Requiem 对
by xzCyanBrad @ 2021-08-20 10:29:15
@罗非鱼Requiem
我的意思是你数组开小了,下标越界了
by xzCyanBrad @ 2021-08-20 10:29:38
@罗非鱼Requiem
by xzCyanBrad @ 2021-08-20 10:33:21
还有,@kkksc0100_juruo ,他空间没超
int=4b
还有,超了是MLE,不是RE
by xzCyanBrad @ 2021-08-20 10:34:30
提个建议:可以用vector或map更好
by xzCyanBrad @ 2021-08-20 10:34:42
@罗非鱼Requiem
by Union_of_Britain @ 2021-08-20 10:38:28
@littlewave
@罗非鱼Requiem 我说的
by Union_of_Britain @ 2021-08-20 10:39:46
@littlewave 就算只占
by xzCyanBrad @ 2021-08-20 11:15:47
1byte=8bit