結果

問題 No.124 門松列(3)
コンテスト
ユーザー 👑 tails
提出日時 2020-10-26 23:40:56
言語 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
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,052 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 117 ms
コンパイル使用メモリ 26,752 KB
最終ジャッジ日時 2026-02-22 06:15:51
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:21:1: error: return type defaults to 'int' [-Wimplicit-int]
   21 | main(){
      | ^~~~
main.c: In function 'main':
main.c:22:17: error: too many arguments to function 'mmap'; expected 0, have 6
   22 |         char*rp=mmap(0l,24l*1024,1,2,0,0ll);
      |                 ^~~~ ~~
main.c:7:6: note: declared here
    7 | char*mmap();
      |      ^~~~
main.c:56:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   56 |         printf("%d",z);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | // original:
main.c:56:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   56 |         printf("%d",z);
      |         ^~~~~~
main.c:56:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #
raw source code

// original:
// https://yukicoder.me/submissions/8485

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

char*mmap();
#define RD(v) int v=0;{int c;while(c=*rp++-48,c>=0)v=v*10+c;}
#define RDL(v) long v=0;{int c;while(c=*rp++-48,c>=0)v=v*10+c;}

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

char q[200000], *qr=q, *qw=q;
int dist[64][128][128];

static inline int isK(int a, int b , int c){
	return !a||a!=c&&(a<b&&b>c||a>b&&b<c);
}

main(){
	char*rp=mmap(0l,24l*1024,1,2,0,0ll);
	RD(w);
	RD(h);

	dist[0][0][0] = 1;
	*qw++ = 0;
	*qw++ = 0;
	*qw++ = 0;

	int z=-1;
	while(qw-qr){
		int k=*qr++;
		int y=*qr++;
		int x=*qr++;

		if(x+y==w+h-2){
			z=dist[k][y][x]-1;
			break;
		}
		int nk=rp[y*w+x<<1];
		int d;
		rep(d,4){
			int ny=y+(d==2)-(d==0);
			int nx=x+(d==3)-(d==1);
			if(ny < 0 || ny >= h || nx<0 || nx>= w) continue;
			if(!isK(k,nk,rp[ny*w+nx<<1])) continue;
			if(dist[nk][ny][nx] > 0) continue;
			dist[nk][ny][nx] = dist[k][y][x] + 1;
			*qw++ = nk;
			*qw++ = ny;
			*qw++ = nx;
		}
	}

	printf("%d",z);
}
0