結果

問題 No.1399 すごろくで世界旅行 (構築)
ユーザー tailstails
提出日時 2021-02-19 23:09:51
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 493 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-16 22:31:30
合計ジャッジ時間 18,577 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:9:1: warning: return type defaults to 'int' [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function 'main':
main.c:13:9: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   13 |         memset(wbuf,'1',v+2);
      |         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:13:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
   13 |         memset(wbuf,'1',v+2);
      |         ^~~~~~
main.c:13:9: note: include '<string.h>' or provide a declaration of 'memset'
main.c:27:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   27 |         write(1,wbuf,n);
      |         ^~~~~

ソースコード

diff #

#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;}

char wbuf[1<<28];

main(){
	char*rp=mmap(0l,1l<<28,1,2,0,0ll);
	RD(v);
	RD(d);
	memset(wbuf,'1',v+2);
	wbuf[v]=10;
	memset(wbuf+(v+2),d==1?'1':'0',v-1);
	wbuf[v*2+1]=10;
	int n=(v+1)*v;
#if 0
	for(int i=v+1;i<n;i+=8){
		*(long*)(wbuf+i+(v+1))=*(long*)(wbuf+i);
	}
#else
	for(int i=v+1;i<n;i+=1){
		*(wbuf+i+(v+1))=*(wbuf+i);
	}
#endif
	write(1,wbuf,n);
}
0