#include<iostream>
#include<vector>
constexpr int MAX = 10e5 + 1;
int n, q;
using namespace std;
struct Chest
{
vector<int>box, item;
int num;
}chest[MAX];
int main()
{
cin >> n >> q;
for (int i = 0; i < q; i++)
{
int a, b, c, d;
cin >> a;
if (1 == a)
{
cin >> b >> c >> d;
chest[b].num++;
chest[b].box.push_back(c);
chest[b].item.push_back(d);
}
else if (2 == a)
{
cin >> b >> c;
for (int i = chest[b].num - 1; i >= 0; i--)
if ((chest[b].box)[i] == c && (chest[b].item)[i] != 0)
{
cout << (chest[b].item)[i] << endl;
break;
}
}
}
return 0;
}
洛谷P3613 【深基15.例2】寄包柜进阶解法
最新推荐文章于 2023-01-11 22:46:56 发布