結果

問題 No.585 工夫のないパズル
コンテスト
ユーザー %20
提出日時 2017-11-01 15:07:02
言語 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  
(最初)
実行時間 -
コード長 951 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 92 ms
コンパイル使用メモリ 28,548 KB
最終ジャッジ日時 2026-02-22 00:28:59
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:3:1: warning: data definition has no type or storage class
    3 | p[100],N;
      | ^
main.c:3:1: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
main.c:3:8: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
    3 | p[100],N;
      |        ^
main.c:5:1: error: return type defaults to 'int' [-Wimplicit-int]
    5 | idx(n){
      | ^~~
main.c: In function 'idx':
main.c:5:1: warning: old-style function definition [-Wold-style-definition]
main.c:5:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | yoko(r,a){
      | ^~~~
main.c: In function 'yoko':
main.c:11:1: warning: old-style function definition [-Wold-style-definition]
main.c:11:1: error: type of 'r' defaults to 'int' [-Wimplicit-int]
main.c:11:1: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:19:1: error: return type defaults to 'int' [-Wimplicit-int]
   19 | tate(c,b){
      | ^~~~
main.c: In function 'tate':
main.c:19:1: warning: old-style function definition [-Wold-style-definition]
main.c:19:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:19:1: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:27:1: error: return type defaults to 'int' [-Wimplicit-int]
   27 | main(i,j){
      | ^~~~
main.c: In function 'main':
main.c:27:1: warning: old-style function definition [-Wold-style-definition]
main.c:27:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:27:1: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:28:29: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
   28 |         for(i=0;i<16;++i&3||getchar()){
      |                             ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | typedef unsigned long l

ソースコード

diff #
raw source code

typedef unsigned long long ull;
ull z;
p[100],N;

idx(n){
	int r,i;
	for(i=0;i<16;++i)(z>>4*i&15)==n?r=15-i:0;
	return r;
}

yoko(r,a){
	ull m=0xffff000000000000ull>>16*(r&=3);
	if(a&=3){
		z=~m&z|m&((m&z)>>4*a|(m&z)<<4*(4-a));
		p[N++]=0<<4|r<<2|a;
	}
}

tate(c,b){
	ull m=0xf000f000f000f000ull>>4*(c&=3);
	if(b&=3){
		z=~m&z|m&((m&z)>>16*b|(m&z)<<16*(4-b));
		p[N++]=1<<4|c<<2|b;
	}
}

main(i,j){
	for(i=0;i<16;++i&3||getchar()){
		z=z<<4|getchar()-1&15;
	}
	for(i=0;i<12;++i){
		j=idx(i);
		if(i!=j){
			if((i&3)==(j&3)){
				yoko(j>>2,1);
				j=j&12|j+1&3;
			}
			tate(j,3-(j>>2));
			tate(i,3-(i>>2));
			yoko(3,i-j);
			tate(i,(i>>2)-3);
			tate(j,(j>>2)-3);
		}
	}
	yoko(3,12-idx(12));
	for(i=13;i<15;++i){
		for(j=idx(i);i!=j;--j){
			tate(j,3);
			yoko(3,2);
			tate(j,1);
			yoko(3,1);
			tate(j,3);
			yoko(3,1);
			tate(j,1);
			yoko(3,1);
		}
	}
	printf("%d\n",N);
	for(i=0;i<N;++i)printf("%c %d %d\n","RC"[p[i]>>4],p[i]>>2&3,p[i]&3);
}
0