Submission #23565

# Submission time Handle Problem Language Result Execution time Memory
23565 2017-05-12T15:56:51 Z repeating Boat (APIO16_boat) C++11
9 / 100
2000 ms 9844 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define pll pair<ll,ll>
#define SF(x) scanf("%I64d",&x)

using namespace std;
const long long INF = 2e9;
long long MOD = 1e9+7;
ll n;
ll a[555];
ll b[555];
map<ll,ll>dp[555];
ll DP(ll x,ll last){
    if(x==n)R 1;
    ll &ret=dp[x][last];
    if(ret)R ret-1;
    ret=DP(x+1,last);
    for(int i=max(last+1,a[x]);i<=b[x];i++){
        ret+=DP(x+1,i);
    }
    ret%=MOD;
    ret++;
    R ret-1;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    cout<<DP(0,0)-1;
}

# Verdict Execution time Memory Grader output
1 Correct 43 ms 9844 KB Output is correct
2 Correct 53 ms 9844 KB Output is correct
3 Correct 36 ms 9844 KB Output is correct
4 Correct 46 ms 9844 KB Output is correct
5 Correct 49 ms 9844 KB Output is correct
6 Correct 73 ms 9844 KB Output is correct
7 Correct 63 ms 9844 KB Output is correct
8 Correct 69 ms 9844 KB Output is correct
9 Correct 66 ms 9844 KB Output is correct
10 Correct 56 ms 9844 KB Output is correct
11 Correct 63 ms 9844 KB Output is correct
12 Correct 73 ms 9844 KB Output is correct
13 Correct 66 ms 9844 KB Output is correct
14 Correct 66 ms 9844 KB Output is correct
15 Correct 63 ms 9844 KB Output is correct
16 Correct 9 ms 4300 KB Output is correct
17 Correct 9 ms 4432 KB Output is correct
18 Correct 6 ms 4432 KB Output is correct
19 Correct 6 ms 4432 KB Output is correct
20 Correct 3 ms 4300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 9844 KB Output is correct
2 Correct 53 ms 9844 KB Output is correct
3 Correct 36 ms 9844 KB Output is correct
4 Correct 46 ms 9844 KB Output is correct
5 Correct 49 ms 9844 KB Output is correct
6 Correct 73 ms 9844 KB Output is correct
7 Correct 63 ms 9844 KB Output is correct
8 Correct 69 ms 9844 KB Output is correct
9 Correct 66 ms 9844 KB Output is correct
10 Correct 56 ms 9844 KB Output is correct
11 Correct 63 ms 9844 KB Output is correct
12 Correct 73 ms 9844 KB Output is correct
13 Correct 66 ms 9844 KB Output is correct
14 Correct 66 ms 9844 KB Output is correct
15 Correct 63 ms 9844 KB Output is correct
16 Correct 9 ms 4300 KB Output is correct
17 Correct 9 ms 4432 KB Output is correct
18 Correct 6 ms 4432 KB Output is correct
19 Correct 6 ms 4432 KB Output is correct
20 Correct 3 ms 4300 KB Output is correct
21 Execution timed out 2000 ms 5752 KB Execution timed out
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 2056 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 9844 KB Output is correct
2 Correct 53 ms 9844 KB Output is correct
3 Correct 36 ms 9844 KB Output is correct
4 Correct 46 ms 9844 KB Output is correct
5 Correct 49 ms 9844 KB Output is correct
6 Correct 73 ms 9844 KB Output is correct
7 Correct 63 ms 9844 KB Output is correct
8 Correct 69 ms 9844 KB Output is correct
9 Correct 66 ms 9844 KB Output is correct
10 Correct 56 ms 9844 KB Output is correct
11 Correct 63 ms 9844 KB Output is correct
12 Correct 73 ms 9844 KB Output is correct
13 Correct 66 ms 9844 KB Output is correct
14 Correct 66 ms 9844 KB Output is correct
15 Correct 63 ms 9844 KB Output is correct
16 Correct 9 ms 4300 KB Output is correct
17 Correct 9 ms 4432 KB Output is correct
18 Correct 6 ms 4432 KB Output is correct
19 Correct 6 ms 4432 KB Output is correct
20 Correct 3 ms 4300 KB Output is correct
21 Execution timed out 2000 ms 5752 KB Execution timed out
22 Halted 0 ms 0 KB -