結果

問題 No.1519 Diversity
ユーザー tailstails
提出日時 2021-05-28 23:05:32
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 00:55:45
合計ジャッジ時間 1,404 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:10:1: warning: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
main.c: In function 'main':
main.c:26:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   26 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:27:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   27 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

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<<25];
#define wt_rev(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}

main(){
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	char*wp=wbuf+sizeof wbuf;
	rd(n);
	int m=0;
	for(int i=1;i<=n;++i){
		for(int j=i+1;j<=n-i+1;++j){
			*--wp=10;
			wt_rev(j);
			*--wp=32;
			wt_rev(i);
			++m;
		}
	}
	*--wp=10;
	wt_rev(m);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0