結果

問題 No.1081 和の和
ユーザー ブルーレヰブルーレヰ
提出日時 2020-06-19 21:44:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,962 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 202,788 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 13:47:41
合計ジャッジ時間 2,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <boost/range/irange.hpp>
// #define RANGE_1(e) (boost::irange(0,(e)))
// #define RANGE_2(s,e) (boost::irange((s),(e)))
// #define RANGE_3(s,e,step) (boost::irange((s), (e), (step)))
// #define RANGE_SELECTER(_1,_2,_3,SELECT,...) SELECT
// #define range(...) RANGE_SELECTER(__VA_ARGS__, RANGE_3, RANGE_2, RANGE_1) (__VA_ARGS__)
#define guard(x) if(x);
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define CALL(x) (x).cbegin(),(x).cend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define BIT(n) (1LL<<(n))

using namespace std;
using lint = long long;

template<class T>class irange{private:struct I{T x;T operator*(){return x;}bool operator!=(I&lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;public:irange(T i,T n):i({i}),n({n}){}I&begin(){return i;}I&end(){return n;}};
template<class T>class srange{private:struct I{T x,s;T operator*(){return x;}bool operator!=(I&lhs){if(s<(T)0)return x>lhs.x;return x<lhs.x;}void operator++(){x=x+s;}};I i,n;public:srange(T i,T n,T s):i({i,s}),n({n,s}){}I&begin(){return i;}I&end(){return n;}};
template<class T>irange<T>range(T n){return irange(0,n);}template<class T>irange<T>range(T i,T n){return irange(i,n);}template<class T>srange<T>range(T i,T n,T s){return srange(i,n,s);}
template<class T>bool amax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool amin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

struct initialize{initialize(){cin.tie(nullptr);ios::sync_with_stdio(false);};}__ini__;

#define MOD 1000000007

int main(){
    /* Code Area */
    lint n;
    std::cin >> n;
    std::vector<lint> a(n);
    for (auto&& e : a) {
       std::cin >> e;
    }

    for (lint i = 0; i < n - 1; ++i) {
        vector<lint> a1(n - i - 1);
        for (lint j = 0; j < n - i - 1; ++j) {
            a1[j] = (a[j] + a[j + 1]) % MOD;
        }
        a = a1;
    }

    cout << a[0] << endl;
}
0