Submission #556480

# Submission time Handle Problem Language Result Execution time Memory
556480 2022-05-03T08:44:08 Z InternetPerson10 Boat (APIO16_boat) C++17
0 / 100
13 ms 16380 KB
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

const ll MOD = 1e9 + 7;
ll BIG = 1000002;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    vector<ll> nums(BIG);
    nums[0] = 1;
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        ll g = 0;
        for(int j = 0; j < a[i]; j++) g += nums[j];
        g %= MOD;
        for(int j = a[i]; j <= b[i]; j++) {
            g += nums[j];
            nums[j] += (g - nums[j]);
            nums[j] += MOD;
            nums[j] %= MOD;
            g %= MOD;
        }
    }
    ll ans = 0;
    for(int i = 1; i < BIG; i++) {
        ans += nums[i];
        ans %= MOD;
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 16380 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 16380 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 16340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 16380 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -