結果

問題 No.1851 Regular Tiling
ユーザー tails
提出日時 2022-03-01 14:06:19
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 20:02:59
合計ジャッジ時間 1,776 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:31:25: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
   31 |                         memcpy(wp,y%3?x122:x011,xlen);
      |                         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memcpy'
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:31:25: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch]
   31 |                         memcpy(wp,y%3?x122:x011,xlen);
      |                         ^~~~~~
main.c:31:25: note: include '<string.h>' or provide a declaration of 'memcpy'
main.c:35:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   35 |         write(1,wbuf,wp-wbuf);
      |         ^~~~~
main.c:36:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   36 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

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

#define rd_skip() while(*rp++>=48)
#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}

char*mmap();
char wbuf[1<<25];

#define A "0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 "
char const a011[]=A A A A A A A;
#undef A
#define A "1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 "
char const a122[]=A A A A A A A;
#undef A

int main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	char*wp=wbuf;

	rd_skip();
	while(*rp){
		rd(h);
		rd(w);
		long hoff=h%3==2;
		long woff=w%3==2;
		char const * x011=a011+2*woff;
		char const * x122=a122+2*woff;
		long xlen=w*2;
		for(long y=h+hoff;--y>=hoff;){
			memcpy(wp,y%3?x122:x011,xlen);
			wp+=xlen;
		}
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0