結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー Mcpu3Mcpu3
提出日時 2018-12-08 10:16:22
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 29,236 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-12 04:54:41
合計ジャッジ時間 989 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

typedef struct {
	int XL, XR, YD;
} enemy;

int compare(const void *x, const void *y)
{
	return ((enemy*)y)->YD - ((enemy*)x)->YD;
}

int main(void)
{
	int N, xLB, xRB, width[1280] = {}, i, j;
	enemy hitJudge[188];
	scanf("%d%d%d", &N, &xLB, &xRB);
	for (i = xLB; i <= xRB; ++i) width[i - 1] = 1;
	for (i = 0; i < N; ++i) {
		scanf("%d%*d%d%d", &hitJudge[i].XL, &hitJudge[i].XR, &hitJudge[i].YD);
		if (hitJudge[i].XL < 1) hitJudge[i].XL = 1;
		if (hitJudge[i].XR > 1280) hitJudge[i].XR = 1280;
	}
	qsort(hitJudge, N, sizeof(enemy), compare);
	for (i = 0; i < N; ++i) {
		for (j = hitJudge[i].XL; j <= hitJudge[i].XR; ++j) {
			if (width[j - 1] == 1) break;
		}
		if (j != hitJudge[i].XR + 1) {
			for (j = hitJudge[i].XL; j <= hitJudge[i].XR; ++j) width[j - 1] = 0;
			puts("1");
		}
		else puts("0");
	}
	return 0;
}
0