結果

問題 No.1618 Convolution?
ユーザー tailstails
提出日時 2021-07-27 23:46:27
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,081 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 31,780 KB
実行使用メモリ 16,172 KB
最終ジャッジ日時 2023-10-01 04:20:43
合計ジャッジ時間 7,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,980 KB
testcase_01 AC 1 ms
4,988 KB
testcase_02 AC 10 ms
8,812 KB
testcase_03 AC 13 ms
10,404 KB
testcase_04 AC 13 ms
9,468 KB
testcase_05 AC 2 ms
5,048 KB
testcase_06 AC 18 ms
12,088 KB
testcase_07 AC 17 ms
12,148 KB
testcase_08 AC 13 ms
9,668 KB
testcase_09 AC 22 ms
14,268 KB
testcase_10 AC 14 ms
10,176 KB
testcase_11 AC 22 ms
13,588 KB
testcase_12 AC 16 ms
14,732 KB
testcase_13 AC 18 ms
14,716 KB
testcase_14 AC 13 ms
16,172 KB
testcase_15 AC 15 ms
14,868 KB
testcase_16 AC 15 ms
14,788 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:32:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
   32 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:72:9: 警告: 関数 ‘write’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   72 |         write(1,wp,wbufend-wp);
      |         ^~~~~
main.c:73:9: 警告: implicit declaration of function ‘_exit’; did you mean ‘_Exit’? [-Wimplicit-function-declaration]
   73 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();
char wbuf[1<<25];

#define wbufend (wbuf+sizeof wbuf)

#define rd(v) long v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define rep(v,e) for(long v=0;v<e;++v)
#define reps(v,s,e) for(long v=s;v<e;++v)
#define rrep(v,e) for(long v=e;v--;)

int base10x4[10000];

void mkbase10(){
	long i=0;
	reps(a,'0','9'+1){
		reps(b,'0','9'+1){
			reps(c,'0','9'+1){
				reps(d,'0','9'+1){
					base10x4[i++]=a|b<<8|c<<16|d<<24;
				}
			}
		}
	}
}

int a[200000];
long c[400000];

main(){
	mkbase10();

	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	long s=0,t=0;
	rep(i,n){
		rd(x);
		a[i]=x;
		c[i]=t+=s+=x;
	}
	rep(i,n){
		long x=a[i];
		c[i+n]=t+=(s-=x)-n*x;
	}
	rep(i,n){
		rd(x);
		a[i]=x;
		c[i]+=t+=s+=x;
	}
	rep(i,n){
		long x=a[i];
		c[i+n]+=t+=(s-=x)-n*x;
	}

	char*wp=wbufend;
	rrep(i,n*2-1){
		*--wp=' ';
		long x=c[i];
		if(x){
			do{
				*(int*)(wp-=4)=base10x4[x%10000];
			}while(x/=10000);
			while(*wp=='0')++wp;
		}else{
			*--wp='0';
		}
	}
	*--wp=' ';
	*--wp='0';
	write(1,wp,wbufend-wp);
	_exit(0);
}
0