崛起的滑稽 @ 2022-10-15 15:11:35
#include<bits/stdc++.h>
using namespace std;
int n,m;
unordered_map<int,int> gui;
int main() {
cin>>n>>m;
for(int i=1;i<=m;++i){
int ctrl;
cin>>ctrl;
if(ctrl==1){
int x,y,w;
cin>>x>>y>>w;
gui[x*n+y]=w;
}
else{
int x,y;
cin>>x>>y;
cout<<gui[x*n+y]<<endl;
}
}
return 0;
}
40分,没有考虑每个寄包柜都有几个格
因为不会
by 崛起的滑稽 @ 2022-10-15 15:12:37
求求各位大佬帮帮我这个蒟蒻吧QWQ
by little_cindy @ 2022-10-15 15:20:04
@崛起的滑稽 建议改成一维map
by little_cindy @ 2022-10-15 15:20:31
@崛起的滑稽
#include<bits/stdc++.h>
using namespace std;
int n,m;
unordered_map<int,int> gui[100005];
int main() {
cin>>n>>m;
for(int i=1;i<=m;++i){
int ctrl;
cin>>ctrl;
if(ctrl==1){
int x,y,w;
cin>>x>>y>>w;
gui[x][y]=w;
}
else{
int x,y;
cin>>x>>y;
cout<<gui[x][y]<<endl;
}
}
return 0;
}
by Usada_Pekora @ 2022-10-15 15:23:53
@崛起的滑稽 考虑直接拉满,即
by 崛起的滑稽 @ 2022-10-15 15:24:21
@little_cindy 哦,好谢谢大佬~
by Usada_Pekora @ 2022-10-15 15:25:57
@崛起的滑稽 你的
然而你不知道第
by 崛起的滑稽 @ 2022-10-15 15:26:24
@Zyingyzzz 哦,明白了,谢谢
by 崛起的滑稽 @ 2022-10-15 15:27:38
过了,感谢各位大佬awa