Submission #405809

# Submission time Handle Problem Language Result Execution time Memory
405809 2021-05-16T23:01:43 Z gevacrt Boat (APIO16_boat) C++17
9 / 100
2000 ms 524292 KB
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

#define INF INT_MAX
#define MOD 1000000007
#define all(x) x.begin(), x.end()

vii A;
vector<gp_hash_table<int, ll>> dp;

void solve(int x, int C){
    auto &v = dp[x][C];
    v += dp[x][C-1]+1; v %= MOD;

    for(int i = 0; i < x; i++){
        v += dp[i][min(C-1, A[i].second)];
        v %= MOD;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int N; cin >> N;
    A.resize(N);
    for(auto &[l, r] : A)
        cin >> l >> r;    
    
    dp.resize(N);

    ll ans = 0;
    for(int x = 0; x < N; x++){
        for(auto [l, r] = A[x]; l <= r; l++)
            solve(x, l);
        ans += dp[x][A[x].second]; ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4684 KB Output is correct
2 Correct 8 ms 4556 KB Output is correct
3 Correct 9 ms 4704 KB Output is correct
4 Correct 9 ms 4812 KB Output is correct
5 Correct 9 ms 4556 KB Output is correct
6 Correct 3 ms 608 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 3 ms 716 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 2 ms 588 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 4 ms 1356 KB Output is correct
17 Correct 5 ms 1356 KB Output is correct
18 Correct 5 ms 1484 KB Output is correct
19 Correct 4 ms 1356 KB Output is correct
20 Correct 4 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4684 KB Output is correct
2 Correct 8 ms 4556 KB Output is correct
3 Correct 9 ms 4704 KB Output is correct
4 Correct 9 ms 4812 KB Output is correct
5 Correct 9 ms 4556 KB Output is correct
6 Correct 3 ms 608 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 3 ms 716 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 2 ms 588 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 4 ms 1356 KB Output is correct
17 Correct 5 ms 1356 KB Output is correct
18 Correct 5 ms 1484 KB Output is correct
19 Correct 4 ms 1356 KB Output is correct
20 Correct 4 ms 1356 KB Output is correct
21 Execution timed out 2088 ms 93916 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 406 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4684 KB Output is correct
2 Correct 8 ms 4556 KB Output is correct
3 Correct 9 ms 4704 KB Output is correct
4 Correct 9 ms 4812 KB Output is correct
5 Correct 9 ms 4556 KB Output is correct
6 Correct 3 ms 608 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 3 ms 716 KB Output is correct
10 Correct 3 ms 588 KB Output is correct
11 Correct 3 ms 588 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 3 ms 588 KB Output is correct
14 Correct 2 ms 588 KB Output is correct
15 Correct 3 ms 588 KB Output is correct
16 Correct 4 ms 1356 KB Output is correct
17 Correct 5 ms 1356 KB Output is correct
18 Correct 5 ms 1484 KB Output is correct
19 Correct 4 ms 1356 KB Output is correct
20 Correct 4 ms 1356 KB Output is correct
21 Execution timed out 2088 ms 93916 KB Time limit exceeded
22 Halted 0 ms 0 KB -