結果

問題 No.2727 Tetrahedron Game
コンテスト
ユーザー 👑 tails
提出日時 2024-04-16 17:55:21
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,512 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 102 ms
コンパイル使用メモリ 28,644 KB
最終ジャッジ日時 2026-02-24 01:18:55
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:31:21: error: expected ';' before 'i'
   31 |                 rep(i,n){
      |                     ^
main.c:7:32: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:31:21: error: 'i' undeclared (first use in this function)
   31 |                 rep(i,n){
      |                     ^
main.c:7:36: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:31:21: note: each undeclared identifier is reported only once for each function it appears in
   31 |                 rep(i,n){
      |                     ^
main.c:7:36: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:38:29: error: expected ';' before 'j'
   38 |                         rep(j,101){
      |                             ^
main.c:7:32: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:38:29: error: 'j' undeclared (first use in this function)
   38 |                         rep(j,101){
      |                             ^
main.c:7:36: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:46:30: error: expected ';' before 'i'
   46 |                         rrep(i,n){
      |                              ^
main.c:9:33: note: in definition of macro 'rrep'
    9 | #define rrep(v,e) for(typeof(e) v=e;v--;)
      |                                 ^
main.c:48:37: error: expected ';' before 'j'
   48 |                                 rep(j,606){
      |                                     ^
main.c:7:32: note: in definition of macro 'rep'
    7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:54:46: error: expec

ソースコード

diff #
raw source code

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rd_signed() ({int _s=*rp=='-'&&++rp,_v=rd();_s?-_v:_v;})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define reps(v,s,e) for(typeof(e) v=s;v<e;++v)
#define rrep(v,e) for(typeof(e) v=e;v--;)
#define chmin(v,a) (v=v<=a?v:a)
#define chmax(v,a) (v=v>=a?v:a)

char wbuf[1<<25];
int a[10000];

int main(){
	char*wp=wbuf;
	rd_init();
	int t=rd();
	while(t--){
		int n=rd();
		int k=rd();
		long h;
		{
			long p11=rd_signed(),p12=rd_signed(),p13=rd_signed();
			long p21=rd_signed(),p22=rd_signed(),p23=rd_signed();
			long p31=rd_signed(),p32=rd_signed(),p33=rd_signed();
			h=p11*(p22*p33-p23*p32)+p12*(p23*p31-p21*p33)+p13*(p21*p32-p22*p31);
			if(h<0) h=-h;
		}
		rep(i,n){
			a[i]=rd();
		}
		char*s=rp+n;
		rp=s+1;
		if(h){
			char d[606];
			rep(j,101){
				d[j*6+0]=j>=k?1:-1;
				d[j*6+1]=0;
				d[j*6+2]=0;
				d[j*6+3]=0;
				d[j*6+4]=0;
				d[j*6+5]=0;
			}
			rrep(i,n){
				char e[606];
				rep(j,606){
					e[j]=d[j];
				}
				int b=a[i]+1;
				if(*--s=='K'){
					int c=b;
					reps(j,1,606){
						chmax(d[j],e[c]);
						c+=b; c-=c<606?0:606;
					}
				}else{
					int c=b;
					reps(j,1,606){
						chmin(d[j],e[c]);
						c+=b; c-=c<606?0:606;
					}
				}
			}
			int z=d[h%606];
			*wp++=z<0?'P':z==0?'D':'K';
		}else{
			*wp++='D';
		}
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0