結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー 👑 ygussanyygussany
提出日時 2021-06-27 13:06:42
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 29,348 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-07 17:30:44
合計ジャッジ時間 3,066 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main()
{
	int i, j, q, Q, N, T, w[10];
	scanf("%d", &Q);
	for (q = 1; q <= Q; q++) {
		scanf("%d %d", &N, &T);
		if (T % 2 != 0) {
			printf("No\n");
			continue;
		}
		printf("Yes\n");
		for (i = 1; i <= N; i++) w[i] = T / (N * 2);
		for (i = 1; i <= N; i++) T -= w[i];
		for (i = 1; T > 0; i++) {
			w[i]++;
			T -= 2;
		}
		for (i = 1; i <= N; i++) for (j = i + 1; j <= N; j++) printf("%d %d %d\n", i, j, w[i] + w[j]);
	}
	fflush(stdout);
	return 0;
}
0