結果

問題 No.801 エレベーター
ユーザー mamekinmamekin
提出日時 2019-03-17 21:55:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,346 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 119,272 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 05:44:11
合計ジャッジ時間 4,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 3 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 149 ms
4,380 KB
testcase_16 AC 148 ms
4,380 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 147 ms
4,380 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 AC 142 ms
4,380 KB
testcase_28 AC 144 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int MOD = 1000000007;

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> l(n), r(n);
    for(int i=0; i<n; ++i)
        cin >> l[i] >> r[i];

    vector<long long> v(n+1, 0);
    v[1] = 1;
    while(--k >= 0){
        vector<long long> sum(n+1, 0);
        for(int i=0; i<n; ++i)
            sum[i+1] = (sum[i] + v[i+1]) % MOD;

        vector<long long> v2(n+2, 0);
        for(int i=0; i<m; ++i){
            long long tmp = (sum[r[i]] - sum[l[i]-1] + MOD) % MOD;
            v2[l[i]] += tmp;
            v2[l[i]] %= MOD;
            v2[r[i]+1] += -tmp + MOD;
            v2[r[i]+1] %= MOD;
        }
        for(int i=1; i<=n; ++i){
            v2[i+1] += v2[i];
            v2[i+1] %= MOD;
        }
        v = move(v2);
        v.resize(n+1);
    }

    int ans = v[n];
    cout << ans << endl;

    return 0;
}
0