結果

問題 No.909 たぴの配置
ユーザー bal4ubal4u
提出日時 2019-10-19 19:32:31
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 20 ms / 3,000 ms
コード長 904 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 29,004 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-09 23:05:56
合計ジャッジ時間 3,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 16 ms
4,380 KB
testcase_06 AC 16 ms
4,376 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 19 ms
4,384 KB
testcase_09 AC 20 ms
4,376 KB
testcase_10 AC 17 ms
4,380 KB
testcase_11 AC 17 ms
4,376 KB
testcase_12 AC 15 ms
4,380 KB
testcase_13 AC 15 ms
4,380 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 17 ms
4,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// yuki 909 たぴの配置
// 2019.10.19 bal4u

#include <stdio.h>
#include <ctype.h>

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[200005];

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;
}
0