#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[n],c[n];
bool fix[n];
fill(fix,fix+n,0);
for(int &i : a){
cin >> i;
if(i!=-1)
i--;
fix[i]=1;
}
for(int &i : c){
cin >> i;
}
long long sum = 0;
for(int i = n-1;i>=0;i--){
sum+=c[i];
cout << sum << " ";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |