結果

問題 No.1376 Simple LPS Problem
ユーザー tailstails
提出日時 2021-05-20 16:47:27
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 14:05:33
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 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 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
testcase_39 AC 1 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 AC 1 ms
5,376 KB
testcase_43 AC 1 ms
5,376 KB
testcase_44 AC 1 ms
5,376 KB
testcase_45 AC 1 ms
5,376 KB
testcase_46 AC 1 ms
5,376 KB
testcase_47 AC 1 ms
5,376 KB
testcase_48 AC 1 ms
5,376 KB
testcase_49 AC 1 ms
5,376 KB
testcase_50 AC 1 ms
5,376 KB
testcase_51 AC 1 ms
5,376 KB
testcase_52 AC 1 ms
5,376 KB
testcase_53 AC 1 ms
5,376 KB
testcase_54 AC 1 ms
5,376 KB
testcase_55 AC 1 ms
5,376 KB
testcase_56 AC 1 ms
5,376 KB
testcase_57 AC 1 ms
5,376 KB
testcase_58 AC 1 ms
5,376 KB
testcase_59 AC 1 ms
5,376 KB
testcase_60 AC 1 ms
5,376 KB
testcase_61 AC 1 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:11:9: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
   11 |         read(0,rbuf,sizeof rbuf);
      |         ^~~~
main.c:18:25: warning: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
   18 |                         strcpy(wbuf,"-1");
      |                         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcpy'
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:18:25: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
   18 |                         strcpy(wbuf,"-1");
      |                         ^~~~~~
main.c:18:25: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:18:32: warning: passing argument 1 of 'strcpy' from incompatible pointer type [-Wincompatible-pointer-types]
   18 |                         strcpy(wbuf,"-1");
      |                                ^~~~
      |                                |
      |                                long int *
main.c:18:32: note: expected 'char *' but argument is of type 'long int *'
main.c:21:25: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
   21 |                         strcpy(wbuf,k==1?"01":k==2?"0011":"00010111");
      |                         ^~~~~~
main.c:21:25: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:21:32: warning: passing argument 1 of 'strcpy' from incompatible pointer type [-Wincompatible-pointer-types]
   21 |                         strcpy(wbuf,k==1?"01":k==2?"0011":"00010111");
      |                                ^~~~
      |                                |
      |                                long int *
main.c:21:32: note: expected 'char *' but argument is of type 'long int *

ソースコード

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

long wbuf[1<<25];
char rbuf[1<<12];

main(){
  	read(0,rbuf,sizeof rbuf);
	char*rp=rbuf;
	RD(n);
	RD(k);
	int off=0;
	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{
		off=7&-k;
		memset(wbuf,'0',off+k);
		long*wp=wbuf+(off+k>>3);
		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;
		}
	}
	*((char*)wbuf+off+n)=10;
	write(1,(char*)wbuf+off,n+1);
}
0