为什么对to数组进行memset(to, 1, sizeof(to))会re,而在输入b[i]时顺便赋值却不会
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int N = 1e5+10;
int n, a[N], b[N], to[N];
priority_queue<pii, vector<pii>, greater<pii> > pq;
int main(){
scanf("%d", &n);
for(int i=1; i<=n; i++) scanf("%d", &a[i]);
for(int i=1; i<=n; i++){
to[i] = 1;
scanf("%d", &b[i]);
pq.push(make_pair(a[1]+b[i], i));
}
for(int i=1; i<=n; i++){
printf("%d ", pq.top().first);
int y = pq.top().second;
pq.pop();
pq.push(make_pair(a[++to[y]]+b[y], y));
}
return 0;
}