結果

問題 No.5026 Spectrum Router
コンテスト
ユーザー 👑 tails
提出日時 2026-11-23 22:35:16
言語 cLay
(20250308-1 + boost 1.92.0 + ACL)
コンパイル:
clayc _filename_
実行:
./a.out
結果
AC  
実行時間 823 ms / 2,000 ms
+ 134µs
コード長 860 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,157 ms
コンパイル使用メモリ 200,748 KB
実行使用メモリ 9,900 KB
スコア 1,394,065
最終ジャッジ日時 2026-11-23 22:37:39
合計ジャッジ時間 43,514 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge6_0
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

constexpr int n=64;
int a[4n],c[n][n];

int f(int y,int x,int dy,int dx){
	int oy=y;
	int ox=x;
	int cc=0;
	while(1){
		y+=dy;
		x+=dx;
		if(y<0) return x;
		if(x>=n) return y+n;
		if(y>=n) return 3n-1-x;
		if(x<0) return 4n-1-y;
		if(y==oy&&x==ox&&++cc==2){
			return -1;
		}
		if(c[y][x]==1){
			(dy,dx)=(-dx,-dy);
		}
		if(c[y][x]==2){
			(dy,dx)=(dx,dy);
		}
	}
}

{
	int @n_;
	rd(a(4n));
	rep(t,200){
		rep(y,n){
			rep(x,n){
				c[y][x]=0;
				int t0=f(y,x,1,0);
				int t1=f(y,x,0,-1);
				int t2=f(y,x,-1,0);
				int t3=f(y,x,0,1);
				if(t0>=0&&t1>=0&&t2>=0&&t3>=0&&t0!=t1&&t0!=t3){
					int s0=t0*a[t2]+t2*a[t0]+t1*a[t3]+t3*a[t1];
					int s1=t0*a[t3]+t3*a[t0]+t1*a[t2]+t2*a[t1];
					int s2=t0*a[t1]+t1*a[t0]+t2*a[t3]+t3*a[t2];
					c[y][x]= s1>s2 ? s1>s0?1:0 : s2>s0?2:0;
				}
			}
		}
	}
	rep(y,n){
		rep(x,n){
			wtN(c[y][x]);
		}
		wt("");
	}
}
0