From 0ee0a08c041dca860799c05ea10b013f1ecc3685 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Fri, 4 Dec 2020 07:33:31 +0800 Subject: [PATCH] =?UTF-8?q?P1160=20=E9=98=9F=E5=88=97=E5=AE=89=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R43142038 --- problem/P1160/P1160.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 problem/P1160/P1160.cpp diff --git a/problem/P1160/P1160.cpp b/problem/P1160/P1160.cpp new file mode 100644 index 00000000..668c1913 --- /dev/null +++ b/problem/P1160/P1160.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +int n, k, p, x; +vector a; +map m; + +int main() { + scanf("%d", &n); + a.push_back(0); + a.push_back(1); + for (int i = 2; i <= n; i++) { + scanf("%d%d", &k, &p); + a.insert(find(a.begin(), a.end(), k) + p, i); + } + scanf("%d", &n); + while (n--) { + scanf("%d", &x); + m[x] = 1; + } + for (vector::iterator it = a.begin() + 1; it != a.end(); it++) { + if(!m[*it]) printf("%d ", *it); + } + printf("\n"); + return 0; +}