mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 15:16:28 +00:00
P3850 [TJOI2007]书架
R70565495
This commit is contained in:
parent
b50080a6cc
commit
6027b94754
33
Luogu/P3850/P3850.cpp
Normal file
33
Luogu/P3850/P3850.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int n, m, q, x, book;
|
||||
std::vector<int> a;
|
||||
std::string s, books[100205];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> s;
|
||||
books[++book] = s;
|
||||
a.push_back(book);
|
||||
}
|
||||
cin >> m;
|
||||
for (int i = 1; i <= m; i++) {
|
||||
cin >> s >> x;
|
||||
books[++book] = s;
|
||||
a.insert(a.begin() + x, book);
|
||||
}
|
||||
cin >> q;
|
||||
while (q--) {
|
||||
cin >> x;
|
||||
cout << books[a[x]] << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user