結果

問題 No.678 2Dシューティングゲームの必殺ビーム
コンテスト
ユーザー pengin_2000
提出日時 2022-01-16 16:58:36
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 823 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 201 ms
コンパイル使用メモリ 40,516 KB
最終ジャッジ日時 2026-02-22 08:44:36
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
int max(int a, int b)
{
	if (a > b)
		return a;
	else
		return b;
}
int main()
{
	int n, l, r;
	scanf("%d %d %d", &n, &l, &r);
	int i, j;
	int xl[202], yu[202], xr[202], yd[202];
	for (i = 0; i < n; i++)
		scanf("%d %d %d %d", &xl[i], &yu[i], &xr[i], &yd[i]);
	int c[202];
	for (i = 0; i < n; i++)
		c[i] = i;
	for (i = 0; i < n - 1; i++)
	{
		if (yd[c[i]] < yd[c[i + 1]])
		{
			c[i] ^= c[i + 1];
			c[i + 1] ^= c[i];
			c[i] ^= c[i + 1];
			if (i > 0)
				i -= 2;
		}
	}
	int ans[202];
	for (i = 0; i < n; i++)
		ans[i] = 0;
	int v[2003];
	for (i = 0; i < 2003; i++)
		v[i] = 0;
	for (i = l; i <= r; i++)
		v[i] = 1;
	for (i = 0; i < n; i++)
	{
		for (j = max(0, xl[c[i]]); j <= xr[c[i]]; j++)
		{
			ans[c[i]] |= v[j];
			v[j] = 0;
		}
	}
	for (i = 0; i < n; i++)
		printf("%d\n", ans[i]);
	return 0;
}
0