結果

問題 No.1376 Simple LPS Problem
ユーザー tailstails
提出日時 2021-02-09 20:08:12
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 30,236 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 07:50:18
合計ジャッジ時間 5,679 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 0 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 0 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 0 ms
4,380 KB
testcase_20 AC 0 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 0 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 0 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 0 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 0 ms
4,380 KB
testcase_33 AC 0 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 0 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 0 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 0 ms
4,376 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 0 ms
4,380 KB
testcase_44 AC 0 ms
4,380 KB
testcase_45 AC 1 ms
4,380 KB
testcase_46 AC 1 ms
4,376 KB
testcase_47 AC 0 ms
4,376 KB
testcase_48 AC 1 ms
4,376 KB
testcase_49 AC 0 ms
4,380 KB
testcase_50 AC 0 ms
4,380 KB
testcase_51 AC 1 ms
4,380 KB
testcase_52 AC 0 ms
4,380 KB
testcase_53 AC 1 ms
4,376 KB
testcase_54 AC 1 ms
4,376 KB
testcase_55 AC 0 ms
4,380 KB
testcase_56 AC 1 ms
4,380 KB
testcase_57 AC 0 ms
4,376 KB
testcase_58 AC 1 ms
4,380 KB
testcase_59 AC 0 ms
4,376 KB
testcase_60 AC 1 ms
4,380 KB
testcase_61 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:9:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:15:25: 警告: 関数 ‘strcpy’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   15 |                         strcpy(wbuf,"-1");
      |                         ^~~~~~
main.c:1:1: 備考: include ‘<string.h>’ or provide a declaration of ‘strcpy’
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:15:25: 警告: 組み込み関数 ‘strcpy’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   15 |                         strcpy(wbuf,"-1");
      |                         ^~~~~~
main.c:15:25: 備考: include ‘<string.h>’ or provide a declaration of ‘strcpy’
main.c:18:25: 警告: 組み込み関数 ‘strcpy’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   18 |                         strcpy(wbuf,k==1?"01":k==2?"0011":"00010111");
      |                         ^~~~~~
main.c:18:25: 備考: include ‘<string.h>’ or provide a declaration of ‘strcpy’
main.c:21:17: 警告: 関数 ‘memset’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   21 |                 memset(wbuf,'0',k);
      |                 ^~~~~~
main.c:21:17: 備考: include ‘<string.h>’ or provide a declaration of ‘memset’
main.c:21:17: 警告: 組み込み関数 ‘memset’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
main.c:21:17: 備考: include ‘<string.h>’ or provide a declaration of ‘memset’
main.c:33:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   33 |         write(1,wbuf,n+1);
      |         ^~~~~

ソースコード

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(n);
	RD(k);
	if(k<4){
		if(k==1&n>2|k==2&n>4|k==3&n>8){
			strcpy(wbuf,"-1");
			n=2;
		}else{
			strcpy(wbuf,k==1?"01":k==2?"0011":"00010111");
		}
	}else{
		memset(wbuf,'0',k);
		long*wp=(long*)(wbuf+k);
		long v0=*(long*)"10110010";
		long v1=*(long*)"11001011";
		long v2=*(long*)"00101100";
		for(int j=n-k;j>0;j-=24){
			*wp++=v0;
			*wp++=v1;
			*wp++=v2;
		}
	}
	wbuf[n]=10;
	write(1,wbuf,n+1);
}
0