QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#668073#9303. Message Bomb4eyebird#WA 0ms3652kbC++171.6kb2024-10-23 11:06:512024-10-23 11:07:06

Judging History

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

  • [2024-10-23 11:07:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-10-23 11:06:51]
  • 提交

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++)
    {
        vint del;
        del.reserve(c[i].size());
        for (auto &[j, k]: c[i])
            del.push_back(j);
        for(auto &j:del)
            tq(i, j);
        cout << ans[i] << '\n';
    }
}

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

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

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:

2
0
1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

2 5 10
1 1 2
3 1 2
2 1 2
1 3 2
1 1 2
3 1 2
3 3 2
1 4 2
3 3 2
1 5 1

output:

2
0
1
1
0

result:

ok 5 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3652kb

input:

10 100 1000
1 49 4
1 75 9
1 90 3
1 4 6
1 76 4
1 60 9
1 62 2
1 70 1
1 99 3
1 54 2
3 70 1
1 16 4
1 28 8
1 29 6
1 93 5
1 96 4
1 85 9
3 4 6
1 28 2
1 5 5
1 1 3
1 42 2
3 5 5
1 66 1
1 79 10
3 70 1
1 58 8
1 50 5
3 76 4
1 20 9
1 66 4
1 88 2
1 23 4
3 99 3
3 79 10
3 70 1
1 54 8
1 90 6
1 13 9
1 79 4
1 59 6
1 8 ...

output:

70
18
69
112
68
105
119
263
94
111
124
69
71
41
121
130
69
155
51
121
122
49
120
86
14
36
102
205
120
25
180
156
49
104
188
81
115
154
48
178
135
41
53
66
123
144
79
74
176
86
25
29
74
68
39
134
67
101
83
171
206
80
127
134
163
83
115
47
130
112
122
57
41
156
100
135
80
63
123
124
135
115
58
2
83
34...

result:

wrong answer 3rd lines differ - expected: '68', found: '69'