Submission #917922

# Submission time Handle Problem Language Result Execution time Memory
917922 2024-01-29T05:36:08 Z irmuun Boat (APIO16_boat) C++17
0 / 100
188 ms 524288 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

const ll mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll a[n+5],b[n+5];
    ll ans=0;
    vector<ll>dp[n+5];
    for(ll i=1;i<=n;i++){
        cin>>a[i]>>b[i];
        dp[i].resize(b[i]-a[i]+1);
    }
    dp[0].pb(1);//first is 0,then ai, ... ,bi
    for(ll i=1;i<=n;i++){
        ll tot=1;
        dp[i][0]=1;
        ll c[n+5];
        for(ll j=1;j<=n;j++){
            c[j]=a[j];
        }
        for(ll j=a[i];j<=b[i];j++){
            for(ll k=1;k<i;k++){
                while(c[k]<j&&c[k]<=b[i]){
                    tot+=dp[k][c[k]-a[k]+1];
                    tot%=mod;
                    c[k]++;
                }
            }
            dp[i][j-a[i]+1]=tot;
            ans+=dp[i][j-a[i]+1];
            ans%=mod;
        }
    }
    cout<<ans<<"\n";
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 760 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 760 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 188 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 760 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -