結果

問題 No.801 エレベーター
ユーザー mamekinmamekin
提出日時 2019-03-17 21:47:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,324 bytes
コンパイル時間 1,121 ms
コンパイル使用メモリ 117,744 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-22 04:57:05
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,504 KB
testcase_03 AC 3 ms
4,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,384 KB
testcase_10 RE -
testcase_11 AC 3 ms
4,384 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 RE -
testcase_15 AC 146 ms
4,380 KB
testcase_16 AC 146 ms
4,384 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 146 ms
4,384 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 AC 141 ms
4,380 KB
testcase_28 AC 143 ms
4,384 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+2, 1);
    v[0] = 0;
    while(--k >= 0){
        vector<long long> v2(n+2, 0);
        for(int i=0; i<m; ++i){
            long long tmp = (v[r[i]] - v[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;
        }
        for(int i=1; i<=n; ++i){
            v2[i+1] += v2[i];
            v2[i+1] %= MOD;
        }
        v = move(v2);
    }

    int ans = (v[n] - v[n-1] + MOD) % MOD;
    cout << ans << endl;

    return 0;
}
0