Submission #739803

# Submission time Handle Problem Language Result Execution time Memory
739803 2023-05-11T10:18:30 Z Magikarp4000 Boat (APIO16_boat) C++17
9 / 100
180 ms 5920 KB
#include <bits/stdc++.h>
using namespace std;
#define OPTM ios_base::sync_with_stdio(0); cin.tie(0);
#define INF int64_t(1e9+7)
#define ln '\n' 
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define FOR(i,s,n) for (int i = s; i < n; i++)
#define FORR(i,n,s) for (int i = n; i > s; i--)
#define FORX(u, arr) for (auto u : arr)
#define PB push_back
#define in(v,x) (v.find(x) != v.end())
#define F first
#define S second
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define UM unordered_map
#define US unordered_set
#define PQ priority_queue
#define ALL(v) v.begin(), v.end()
const ll LLINF = 1e18+1;
#define int long long

const int MAXN = 5e2+1;
int n;
int l[MAXN], r[MAXN];
vector<int> uncc;
UM<int,int> cc;
US<int> vis;
int dp[MAXN][MAXN*3];

void add(int x) {
    if (!vis.count(x)) {
        vis.insert(x);
        uncc.PB(x);
    }
}

signed main() {
    OPTM;
    cin >> n;
    FOR(i,1,n+1) {
        cin >> l[i] >> r[i];
        add(l[i]); add(r[i]);
    }
    uncc.PB(0);
    sort(ALL(uncc));
    int vn = uncc.size();
    FOR(i,0,vn) cc[uncc[i]] = i;
    FOR(i,1,n+1) {
        int cl = cc[l[i]], cr = cc[r[i]];
        FOR(j,cl,cr+1) {
            dp[i][j] = 1;
            FOR(k,1,i) dp[i][j] = (dp[i][j]+dp[k][j-1])%INF;
        }
        FOR(j,1,vn) dp[i][j] = (dp[i][j]+dp[i][j-1])%INF;
    }
    // FOR(i,1,n+1) {
    //     FOR(j,0,vn) cout << dp[i][j] << ' ';
    //     cout << ln;
    // }
    int res = 0;
    FOR(i,1,n+1) res = (res+dp[i][vn-1])%INF;
    cout << res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4308 KB Output is correct
2 Correct 5 ms 4308 KB Output is correct
3 Correct 5 ms 4304 KB Output is correct
4 Correct 5 ms 4308 KB Output is correct
5 Correct 5 ms 4308 KB Output is correct
6 Correct 5 ms 4248 KB Output is correct
7 Correct 6 ms 4308 KB Output is correct
8 Correct 5 ms 4308 KB Output is correct
9 Correct 5 ms 4308 KB Output is correct
10 Correct 6 ms 4320 KB Output is correct
11 Correct 5 ms 4308 KB Output is correct
12 Correct 5 ms 4308 KB Output is correct
13 Correct 5 ms 4308 KB Output is correct
14 Correct 5 ms 4308 KB Output is correct
15 Correct 5 ms 4308 KB Output is correct
16 Correct 2 ms 2648 KB Output is correct
17 Correct 3 ms 2644 KB Output is correct
18 Correct 3 ms 2644 KB Output is correct
19 Correct 3 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4308 KB Output is correct
2 Correct 5 ms 4308 KB Output is correct
3 Correct 5 ms 4304 KB Output is correct
4 Correct 5 ms 4308 KB Output is correct
5 Correct 5 ms 4308 KB Output is correct
6 Correct 5 ms 4248 KB Output is correct
7 Correct 6 ms 4308 KB Output is correct
8 Correct 5 ms 4308 KB Output is correct
9 Correct 5 ms 4308 KB Output is correct
10 Correct 6 ms 4320 KB Output is correct
11 Correct 5 ms 4308 KB Output is correct
12 Correct 5 ms 4308 KB Output is correct
13 Correct 5 ms 4308 KB Output is correct
14 Correct 5 ms 4308 KB Output is correct
15 Correct 5 ms 4308 KB Output is correct
16 Correct 2 ms 2648 KB Output is correct
17 Correct 3 ms 2644 KB Output is correct
18 Correct 3 ms 2644 KB Output is correct
19 Correct 3 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Incorrect 180 ms 5920 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4308 KB Output is correct
2 Correct 5 ms 4308 KB Output is correct
3 Correct 5 ms 4304 KB Output is correct
4 Correct 5 ms 4308 KB Output is correct
5 Correct 5 ms 4308 KB Output is correct
6 Correct 5 ms 4248 KB Output is correct
7 Correct 6 ms 4308 KB Output is correct
8 Correct 5 ms 4308 KB Output is correct
9 Correct 5 ms 4308 KB Output is correct
10 Correct 6 ms 4320 KB Output is correct
11 Correct 5 ms 4308 KB Output is correct
12 Correct 5 ms 4308 KB Output is correct
13 Correct 5 ms 4308 KB Output is correct
14 Correct 5 ms 4308 KB Output is correct
15 Correct 5 ms 4308 KB Output is correct
16 Correct 2 ms 2648 KB Output is correct
17 Correct 3 ms 2644 KB Output is correct
18 Correct 3 ms 2644 KB Output is correct
19 Correct 3 ms 2644 KB Output is correct
20 Correct 3 ms 2644 KB Output is correct
21 Incorrect 180 ms 5920 KB Output isn't correct
22 Halted 0 ms 0 KB -