結果

問題 No.231 めぐるはめぐる (1)
ユーザー pengin_2000pengin_2000
提出日時 2020-02-22 03:07:32
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 30,976 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 19:40:01
合計ジャッジ時間 2,298 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
int min(int a, int b)
{
	if (a < b)
		return a;
	else
		return b;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int g[1003], d[1003];
	for (i = 0; i < n; i++)
		scanf("%d %d", &g[i], &d[i]);
	for (i = 0; i < n; i++)
		g[i] -= 30000 * d[i];
	int c[1003];
	for (i = 0; i < n; i++)
		c[i] = i;
	for (i = 0; i < n - 1; i++)
	{
		if (g[c[i]] < g[c[i + 1]])
		{
			c[i] ^= c[i + 1];
			c[i + 1] ^= c[i];
			c[i] ^= c[i + 1];
			if (i > 0)
				i -= 2;
		}
	}
	if (g[c[0]] * 6 < 300000)
	{
		printf("NO\n");
		return 0;
	}
	printf("YES\n");
	printf("1\n1\n1\n1\n1\n1\n");
	return 0;
}
0