QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#601124 | #9303. Message Bomb | yeah14 | WA | 8ms | 52388kb | C++17 | 1.5kb | 2024-09-29 20:55:02 | 2024-09-29 20:55:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull long long
#define PII pair<int ,int>
const int INF = -1145141919810;
const int mod = 1e9 + 7;
const int N = 1e6;
int ans[N];
map<int, bool>mp[N];
int cnt[N];
//harbin;0 h;1,a;2 r;3 b;4 i;5 n
void solve() {
int n, m, s;
cin >> n >> m >> s;
while (s--) {
int op, x, y;
cin >> op >> x >> y;
if (op == 1)mp[y][x] = 1;
else if (op == 2) {
if (cnt[y] != 0) {
for (auto q = mp[y].begin(); q != mp[y].end(); q++) {
ans[(*q).first]+=cnt[y];
}
}
cnt[y] = 0;
mp[y].erase(x);
}
else if (op == 3) {
ans[x]--;
cnt[y]++;
}
}
for (int i = 1; i <= n; i++) {
if (cnt[i] != 0) {
for (auto q = mp[i].begin(); q != mp[i].end(); q++) {
ans[(*q).first] += cnt[i];
}
}
}
for (int i = 1; i <= m; i++)cout << ans[i] << "\n";
}
//&&(((sum[n]+k)%mid==0)||(sum[n]/mid!=(sum[n]+k)/mid)||(mid-(sum[n]%mid)>=k))
signed main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int t=1;
//cin >> t;
//er(9e6);
while (t--)solve();
}
//int n;
//cin >> n;
//for (int i = 1; i <= n; i++) {
// cin >> a[i];
//}
//int maxx = 0, minn = INF;
//int sum = 0;
//for (int i = n; i <= 1; i++) {
// sum += minn;
// if (top == 0) {
// minn = a[i];
// st[top++] = a[i];
// }
// else {
// if (a[i] > top && a[i] > minn)
// }
//}
//cout << maxx - minn << endl;
//7 2 1 4 5 1 3 3
//4 1000 1000 1000 1000
//0
详细
Test #1:
score: 100
Accepted
time: 8ms
memory: 51176kb
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: -100
Wrong Answer
time: 0ms
memory: 52388kb
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 3 0
result:
wrong answer 4th lines differ - expected: '1', found: '3'