結果

問題 No.511 落ちゲー 〜手作業のぬくもり〜
ユーザー shimasuzu@live.jpshimasuzu@live.jp
提出日時 2017-04-28 23:46:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 1,159 ms
コンパイル使用メモリ 26,900 KB
実行使用メモリ 7,960 KB
最終ジャッジ日時 2023-10-11 19:52:06
合計ジャッジ時間 7,687 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,800 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,352 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 3 ms
4,352 KB
testcase_23 AC 3 ms
4,352 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 3 ms
4,352 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>


typedef long long ll;


int n, w;
ll h;

ll bh[100000+1];


int solve(void)
{
	int a, b, x, i, j, ret=-1, rest;
	int score[2]={0, 0};

	rest=w;
	memset(bh, 0, sizeof(bh));
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d", &a, &b, &x);
		if(ret>=0) break;

		for(j=0;j<a;j++)
		{
			if(bh[x+j]<h)
			{
				bh[x+j]+=b;
				if(bh[x+j]>=h)
				{
					score[i%2]++;
					rest--;
					if(!rest)
					{
						if(score[0]==score[1]) ret=0;
						if(score[0]>score[1]) ret=1;
						if(score[0]<score[1]) ret=2;
					}
				}
			}
		}
	}
/*
printf("n=%d h=%lld w=%d\n", n, h, w);
printf("score=(%d,%d) ret=%d\n", score[0], score[1], ret);
for(j=1;j<=w;j++) printf("%lld ", bh[j]);
printf("\n");
*/
	return ret;
}


int main(void)
{
	char result[][5]={"DRAW", "A", "B"};

	while(scanf("%d%d%lld", &n, &w, &h)==3)
	{
		printf("%s\n", result[solve()]);
	}
	return 0;
}
0