結果

問題 No.893 お客様を誘導せよ
ユーザー bal4ubal4u
提出日時 2019-09-27 21:42:03
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 1,042 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 30,128 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 17:40:59
合計ジャッジ時間 1,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 7 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder 893 お客様を誘導せよ
// 2019.9.27 bal4u

#include <stdio.h>

#if 1
int getchar_unlocked(void);
int putchar_unlocked(int c);
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	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 {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
}

int N;
int a[1003][105], p[1003], k[1003];
int q[100010]; int end;

int main()
{
	int i, j, e;
	
	N = in(); for (i = 0; i < N; i++) {
		p[i] = in();
		for (j = 0; j < p[i]; j++) a[i][j] = in();
	}
	end = e = 0;
	i = 0; while (1) {
		if (k[i] < p[i]) q[e++] = a[i][k[i]++];
		if (++i == N) {
			if (e == end) break;
			end = e, i = 0;
		}
	}
	i = 1; out(q[0]);
	while (i < end) pc(' '), out(q[i++]);
	pc('\n');
	return 0;
}
0