2022-11-04 13:52:19 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <cmath>
|
|
|
|
#include <functional>
|
|
|
|
#include <set>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using std::cin;
|
|
|
|
using std::cout;
|
|
|
|
const char endl = '\n';
|
|
|
|
|
|
|
|
const int N = 2e5 + 5;
|
|
|
|
|
|
|
|
int n, m, lst, cnt;
|
|
|
|
long long a[N], b[N];
|
2022-11-04 14:09:53 +00:00
|
|
|
std::set<std::pair<long long, int>> q[N];
|
|
|
|
std::vector<std::pair<int, std::set<std::pair<long long, int>>::iterator>> ids[N];
|
2022-11-04 13:52:19 +00:00
|
|
|
|
|
|
|
int main() {
|
|
|
|
std::ios::sync_with_stdio(false);
|
|
|
|
cin.tie(nullptr);
|
|
|
|
|
|
|
|
cin >> n >> m;
|
|
|
|
|
|
|
|
while (m--) {
|
|
|
|
int op;
|
|
|
|
|
|
|
|
cin >> op;
|
|
|
|
|
|
|
|
if (op == 1) {
|
|
|
|
int y, k;
|
|
|
|
|
|
|
|
cin >> y >> k;
|
|
|
|
|
|
|
|
a[++cnt] = y ^= lst;
|
|
|
|
int v = std::ceil(static_cast<double>(y) / k);
|
|
|
|
|
|
|
|
for (int i = 1, x; i <= k; i++) {
|
|
|
|
cin >> x;
|
|
|
|
|
2022-11-04 14:09:53 +00:00
|
|
|
x ^= lst;
|
|
|
|
ids[cnt].emplace_back(x, q[x].emplace(b[x] + v, cnt).first);
|
2022-11-04 13:52:19 +00:00
|
|
|
a[cnt] += b[x];
|
|
|
|
}
|
|
|
|
} else { // op == 2
|
|
|
|
int x, y;
|
|
|
|
std::set<int> ans;
|
|
|
|
|
|
|
|
cin >> x >> y;
|
|
|
|
|
|
|
|
b[x ^= lst] += y ^= lst;
|
|
|
|
|
2022-11-04 14:09:53 +00:00
|
|
|
while (!q[x].empty() && q[x].begin()->first <= b[x]) {
|
|
|
|
int id = q[x].begin()->second;
|
2022-11-04 13:52:19 +00:00
|
|
|
|
|
|
|
long long rest = a[id];
|
2022-11-04 14:09:53 +00:00
|
|
|
for (auto o : ids[id]) {
|
|
|
|
rest -= b[o.first];
|
|
|
|
q[o.first].erase(o.second);
|
2022-11-04 13:52:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rest <= 0) {
|
|
|
|
ans.emplace(id);
|
2022-11-04 14:09:53 +00:00
|
|
|
ids[id].clear();
|
2022-11-04 13:52:19 +00:00
|
|
|
} else {
|
|
|
|
int v = std::ceil(static_cast<double>(rest) / ids[id].size());
|
|
|
|
|
2022-11-04 14:09:53 +00:00
|
|
|
for (auto &o : ids[id]) {
|
|
|
|
o.second = q[o.first].emplace(b[o.first] + v, id).first;
|
2022-11-04 13:52:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << (lst = ans.size());
|
|
|
|
for (int x : ans) cout << ' ' << x;
|
|
|
|
cout << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|