結果

問題 No.1618 Convolution?
ユーザー kotatsugamekotatsugame
提出日時 2021-07-28 01:30:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 64,732 KB
実行使用メモリ 11,516 KB
最終ジャッジ日時 2023-10-01 05:34:39
合計ジャッジ時間 6,717 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,448 KB
testcase_01 AC 2 ms
5,576 KB
testcase_02 AC 80 ms
11,164 KB
testcase_03 AC 96 ms
11,240 KB
testcase_04 AC 101 ms
11,020 KB
testcase_05 AC 10 ms
5,696 KB
testcase_06 AC 131 ms
11,208 KB
testcase_07 AC 130 ms
11,184 KB
testcase_08 AC 102 ms
11,024 KB
testcase_09 AC 156 ms
11,356 KB
testcase_10 AC 108 ms
11,048 KB
testcase_11 AC 148 ms
11,344 KB
testcase_12 AC 163 ms
11,364 KB
testcase_13 AC 165 ms
11,352 KB
testcase_14 AC 165 ms
11,516 KB
testcase_15 AC 164 ms
11,448 KB
testcase_16 AC 164 ms
11,508 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:24:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   24 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
long sA[4<<17],sB[4<<17];
int A[2<<17];
void f(long S[])
{
	S[0]=0;
	for(int i=1;i<2*N;i++)
	{
		S[i]=S[i-1];
		if(i<=N)
		{
			cin>>A[i];
			S[i]+=A[i];
		}
		else
		{
			S[i]-=(long)(N+1)*A[i-N];
			if(i>N+1)S[i]+=(long)N*A[i-N-1];
		}
	}
}
main()
{
	cin>>N;
	f(sA);
	f(sB);
	long ans=0;
	for(int i=1;i<=2*N;i++)
	{
		cout<<(ans+=sA[i-1]+sB[i-1])<<(i==2*N?"\n":" ");
	}
}
0