結果
| 問題 | No.3641 OHO SHI KA TSU(Waiting ver.) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-25 16:47:44 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 244 ms / 2,500 ms |
| + 681µs | |
| コード長 | 830 bytes |
| 記録 | |
| コンパイル時間 | 1,420 ms |
| コンパイル使用メモリ | 219,728 KB |
| 実行使用メモリ | 147,124 KB |
| 最終ジャッジ日時 | 2026-08-25 16:47:53 |
| 合計ジャッジ時間 | 5,283 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 20 % | AC * 5 |
| 小課題2 | 30 % | AC * 11 |
| 小課題3 | 30 % | AC * 10 |
| 小課題4 | 20 % | AC * 25 |
| 合計 | 100 点 |
ソースコード
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
using i128 = __int128;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, M, Q;
std::cin >> N >> M >> Q;
std::unordered_map<int, std::deque<int>> q;
std::vector<int> ans(M + 1);
while (Q--) {
int op, x, y;
std::cin >> op >> x >> y;
if (op == 1) {
//! 人x排到y末尾
q[y].push_back(x);
} else {
//! x队头购买商品,然后到t末尾
int z = q[x].front();
q[x].pop_front();
ans[z]++;
q[y].push_back(z);
}
}
for (int i = 1; i <= M; i++) {
std::cout << ans[i] << '\n';
}
return 0;
}