// yuki 909 たぴの配置 // 2019.10.19 bal4u #include #include int getchar_unlocked(void); int putchar_unlocked(int c); #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) int in() { // 非負整数の入力 int n = 0; int c; do c = gc(); while (isspace(c)); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } void out(int n) { // 非負整数の表示(出力) int i; char b[30]; if (!n) pc('0'); else { i = 0; while (n) b[i++] = n % 10 + '0', n /= 10; while (i--) pc(b[i]); } pc('\n'); } int X[100005]; int main() { int i, a, mi, N; N = in(); mi = 0x7ffffff; for (i = 0; i < N; ++i) X[i] = in(); for (i = 0; i < N; ++i) { if ((a = X[i] + in()) < mi) mi = a; } out(mi); out(0); for (i = 0; i < N; i++){ if (X[i] > mi) X[i] = mi; out(X[i]); } out(mi); return 0; }