結果
| 問題 | 
                            No.797 Noelちゃんとピラミッド
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Bwambocos
                         | 
                    
| 提出日時 | 2019-03-15 21:35:06 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 607 bytes | 
| コンパイル時間 | 1,645 ms | 
| コンパイル使用メモリ | 172,600 KB | 
| 実行使用メモリ | 13,756 KB | 
| 最終ジャッジ日時 | 2024-07-01 20:31:44 | 
| 合計ジャッジ時間 | 5,386 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | TLE * 1 -- * 59 | 
ソースコード
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
const LL mod = 1000000007;
int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N);
	rep(i, N) in >> a[i];
	LL ans = 0;
	std::vector<LL>res;
	res.push_back(1);
	rep(i, N - 1)
	{
		std::vector<LL>res_new;
		res_new.resize(i + 2);
		res_new[0] = res_new[i + 1] = 1;
		for (int j = 1; j < i + 1; ++j) res_new[j] = (res[j - 1] + res[j]) % mod;
		res = res_new;
	}
	rep(i, N)
	{
		LL temp = ((a[i] % mod)*(res[i] % mod)) % mod;
		(ans += temp) %= mod;
	}
	out << ans << std::endl;
}
            
            
            
        
            
Bwambocos