QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#668040#9303. Message Bomb4eyebird#RE 0ms0kbC++171.5kb2024-10-23 10:51:572024-10-23 10:52:02

Judging History

你现在查看的是最新测评结果

  • [2024-10-23 10:52:02]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-10-23 10:51:57]
  • 提交

answer

#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;

#define Buff ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long

int n, m, s;
vector<vint> a;
vector<map<int, int>> b;
vector<map<int, int>> c;
vector<ll> ans;

void solve()
{
    cin >> n >> m >> s;
    a.resize(n + 1);
    b.resize(m + 1);
    c.resize(m + 1);
    ans.resize(m + 1);

    auto tq = [&](int x, int y) -> void
    {
        int l = 0, r = a[y].size() - 1;
        while (l < r)
        {
            int mid = (l + r) >> 1;
            if (a[y][mid] < c[x][y])
                l = mid + 1;
            else
                r = mid;
        }
        int as = a[y].size() - l - b[x][y];
        ans[x] += as;
        b[x].erase(y);
        c[x].erase(y);
    };

    int T = 0;
    while (s--)
    {
        T++;
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 1)
        {
            b[x][y] = 0;
            c[x][y] = T;
        }
        else if (t == 2)
        {
            tq(x, y);
        }
        else if (t == 3)
        {
            b[x][y]++;
            a[y].push_back(T);
        }
    }
    for (int i = 1; i <= m; i++)
    {
        for (auto &[j, k]: c[i])
        {
            tq(i, j);
        }
        cout << ans[i] << '\n';
    }
}

signed main()
{
    Buff;
    int _T_ = 1;
    //    cin >> _T_;
    while (_T_--)
        solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

3 3 10
1 3 2
1 3 1
1 1 2
1 2 1
3 1 2
2 3 1
3 3 2
3 2 1
3 3 2
3 2 1

output:


result: