20分,只过了#1和#6
查看原帖
20分,只过了#1和#6
772815
一咕咕一楼主2024/7/18 16:58
#include <bits/stdc++.h>
using namespace std;
class Node
{
public:
    int l, r;
};
bool cmp(const Node &a, const Node &b)
{
    return a.r < b.r;
}
map<Node, int, function<bool(const Node &, const Node &)>> mp(cmp);
int n, q;
void solve(void)
{
    cin >> n >> q;
    for (int i = 1; i <= q; i++)
    {
        int op;
        cin >> op;
        if (op == 1)
        {
            int l, r, k;
            cin >> l >> r >> k;
            mp.insert({{l, r}, k});
        }
        else
        {
            int l, r;
            cin >> l >> r;
            cout << mp[{l, r}] << '\n';
        }
    }
    return;
}
int main()
{
    // freopen(".in","r",stdin);
    // freopen(".out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();

    return 0;
}
2024/7/18 16:58
加载中...