mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 21:16:27 +00:00
P1160 队列安排
R58926378
This commit is contained in:
parent
ad44e32e09
commit
463d3ce984
@ -2,26 +2,30 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int n, k, p, x;
|
int n, k, p, m, x, t;
|
||||||
vector<int> a;
|
list<int> a;
|
||||||
map<int, bool> m;
|
list<int>::iterator b[100005];
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
scanf("%d", &n);
|
cin >> n;
|
||||||
a.push_back(0);
|
|
||||||
a.push_back(1);
|
a.push_back(1);
|
||||||
|
b[1] = a.begin();
|
||||||
for (int i = 2; i <= n; i++) {
|
for (int i = 2; i <= n; i++) {
|
||||||
scanf("%d%d", &k, &p);
|
cin >> k >> p;
|
||||||
a.insert(find(a.begin(), a.end(), k) + p, i);
|
auto it = b[k];
|
||||||
|
b[i] = a.insert(p ? next(it) : it, i);
|
||||||
}
|
}
|
||||||
scanf("%d", &n);
|
cin >> m;
|
||||||
while (n--) {
|
for (int i = 1; i <= m; i++) {
|
||||||
scanf("%d", &x);
|
cin >> x;
|
||||||
m[x] = 1;
|
if (b[x] != a.end()) {
|
||||||
|
a.erase(b[x]);
|
||||||
|
b[x] = a.end();
|
||||||
}
|
}
|
||||||
for (vector<int>::iterator it = a.begin() + 1; it != a.end(); it++) {
|
|
||||||
if(!m[*it]) printf("%d ", *it);
|
|
||||||
}
|
}
|
||||||
printf("\n");
|
for (auto it = a.begin(); it != a.end(); it++) {
|
||||||
|
cout << *it << ' ';
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user