版本比较
P9974
正文
增加 5 行删除 5 行
19 行未改动20212223242524252627282930303132333435363738393940414242434445465 行未改动19 行未改动 for(int i = 1;i <= n;i++) cin >> a[i]; for(int i = 1;i <= m;i++) cin >> b[i];
for(int i = 1;i <= m;i++){ if(b[i] <= a[1]){ a[1]+=b[i]; continue; } } int tmp = 1; for(int j = 1;j <= n;j++) if(a[j] >= tmp && tmp <= b[i]){ int t=a[j]+1; a[j] += min(a[j]-tmp+1,b[i]-tmp+1); tmp = t; } }
for(int i = 1;i <= n;i++) cout<<a[i]<<endl;
}
signed main(){ ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);5 行未改动