結果

問題 No.678 2Dシューティングゲームの必殺ビーム
ユーザー tsuishitsuishi
提出日時 2021-04-14 14:58:27
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 3,539 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 29,396 KB
実行使用メモリ 4,572 KB
最終ジャッジ日時 2023-09-13 04:37:28
合計ジャッジ時間 1,479 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// for debug
#define DEBUGd
// -----------

#define NOP do{}while(0)
#ifdef DEBUG
#include <time.h>
#define TRACE(...) do{printf(__VA_ARGS__);fflush(stdout);}while(0)
#define TRACECR do{putchar_unlocked('\n');fflush(stdout);}while(0)
static clock_t	startclock;
void DEBUGSTART(void){TRACE("--DEBUG MODE --\n");startclock=clock();}
void DEBUGEND(void){startclock=clock()-startclock;TRACE("--finish --\ntime is %.3fms\n",startclock/1000.);}
#else
#define TRACE(...) NOP
#define TRACECR NOP
void DEBUGSTART(void){return;}
void DEBUGEND(void){return;}
#endif


extern int getchar_unlocked(void);
extern int putchar_unlocked(int);
#define gc(d)	(d)=getchar_unlocked()
#define	pc(d) putchar_unlocked(d)
#define SWAP(type,a,b) do{type _c;_c=a;a=b;b=_c;}while(0)
#define MAX(a,b)	((a)>(b)?(a):(b))
#define MIN(a,b)	((a)<(b)?(a):(b))
#define REP(a,b) for(int a=0;a<(int)(b);++a)
#define REP1(a,b) for(int a=1;a<=(int)(b);++a)
static char *GETWORD(char* str) {char c;char *cp;cp=&str[0];gc(c);while(c!=EOF){if((c==' ')||(c=='\n'))break;*cp++=c;gc(c);}*cp='\0';return &str[0];}
#define GETLINE(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
#define mygc(c) (c)=getchar()
static void read1(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
static void read2(int *x, int *y){read1(x);read1(y);}
#define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
#define REP(a,b) for(int a=0;a<(int)(b);++a)
#define lolong long long
static int GETLINEINT(void) {char s[34];GETLINE(s);return atoi(s);}
static int GETLINELONG(void) {char s[34];GETLINE(s);return atol(s);}
static int GETWORDINT(void) {char s[34];GETWORD(s);return atoi(s);}
static int GETWORDLONG(void) {char s[34];GETWORD(s);return atol(s);}
static int cmpint_asc(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
static int cmpint_desc(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
#define	ull	unsigned long long
// *********************
int	enenum[1281];
int	bokan[200];
typedef struct ENMY {
	int	xs;
	int	xe;
	int	y;
	int	num;
} ENMDEF;
ENMDEF	enemy[200];
int	N;
int	LB,RB;
// *********************
extern  int cmpintint(const void * n1, const void * n2)
{
    ull  a, b;
    ENMDEF *dp1,*dp2;
    dp1 = (ENMDEF*)n1;    a = dp1->y;
    dp2 = (ENMDEF*)n2;    b = dp2->y;
#if 1
    // 1 is 降順 5 4 3 2 1
    if( a > b ) return -1;
    else if( a < b ) return 1;
    else return 0;
#else
    // 0 is 昇順 1 2 3 4 5
    if( a < b ) return -1;
    else if( a > b ) return 1;
    else return 0;
#endif
}
void init(void)
{
	REP(i,1281) {
		enenum[i] = 0;
	}
	REP(i,200) {
		bokan[i] = 0;
	}
}
void read(void)
{
	scanf("%d%d%d", &N, &LB, &RB );
	REP(i,N) {
		int	xl,yu,xr,yd;
		scanf("%d%d%d%d", &xl, &yu, &xr, &yd );
		enemy[i].num = i +1;
		enemy[i].xs = MAX(xl,0);
		enemy[i].xe = xr;
		enemy[i].y  = yd;
	}
	qsort( enemy, N , sizeof( enemy[0] ), cmpintint );
}
void beam(void)
{
	REP(i,N) {
		int	num = enemy[i].num;
		int	bf = 0;
		enemy[i].num = i;
		for(int k= enemy[i].xs ; k <= enemy[i].xe ; k ++ ) {
			if( !enenum[k] ) {
				if(!bf) bf = 1;
				enenum[k] = num;
			}
		}
		bokan[num-1] = bf;
	}
}
// *********************
int main( void )
{

	read();
	beam();
	REP(i,N) printf("%d\n",bokan[i]);
}

0