結果
| 問題 | 
                            No.1376 Simple LPS Problem
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2021-05-20 16:47:27 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 688 bytes | 
| コンパイル時間 | 587 ms | 
| コンパイル使用メモリ | 31,232 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-10 07:17:18 | 
| 合計ジャッジ時間 | 2,648 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 60 | 
コンパイルメッセージ
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 *
            
            ソースコード
#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);
}
            
            
            
        
            
tails