답안 #501349

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501349 2022-01-02T20:59:18 Z Abrar_Al_Samit Boat (APIO16_boat) C++17
9 / 100
3 ms 1356 KB
#include<bits/stdc++.h>
using namespace std;
const int MX = 505;
const int Mod = 1e9 + 7;
int a[MX], b[MX];
int dp[MX][MX];
int n;
int solve(int i, int prev) {
    if(i>n) return (prev!=0);
    int &ret = dp[i][prev];
    if(ret!=-1) return ret;
    ret = solve(i+1, prev);
    if(b[i]>a[prev]) ret = (ret+solve(i+1, i))%Mod;
    return ret;
}
void PlayGround() {
    cin >> n;
    for(int i=1; i<=n; ++i) {
        cin >> a[i] >> b[i];
    }   
    memset(dp, -1, sizeof dp);
    cout << solve(1, 0) << endl;

}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    PlayGround();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1356 KB Output is correct
2 Correct 2 ms 1352 KB Output is correct
3 Correct 3 ms 1356 KB Output is correct
4 Correct 2 ms 1356 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1356 KB Output is correct
9 Correct 2 ms 1348 KB Output is correct
10 Correct 2 ms 1352 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 2 ms 1356 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 3 ms 1356 KB Output is correct
15 Correct 3 ms 1356 KB Output is correct
16 Correct 3 ms 1356 KB Output is correct
17 Correct 2 ms 1356 KB Output is correct
18 Correct 2 ms 1356 KB Output is correct
19 Correct 2 ms 1352 KB Output is correct
20 Correct 2 ms 1352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1356 KB Output is correct
2 Correct 2 ms 1352 KB Output is correct
3 Correct 3 ms 1356 KB Output is correct
4 Correct 2 ms 1356 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1356 KB Output is correct
9 Correct 2 ms 1348 KB Output is correct
10 Correct 2 ms 1352 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 2 ms 1356 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 3 ms 1356 KB Output is correct
15 Correct 3 ms 1356 KB Output is correct
16 Correct 3 ms 1356 KB Output is correct
17 Correct 2 ms 1356 KB Output is correct
18 Correct 2 ms 1356 KB Output is correct
19 Correct 2 ms 1352 KB Output is correct
20 Correct 2 ms 1352 KB Output is correct
21 Incorrect 2 ms 1344 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1356 KB Output is correct
2 Correct 2 ms 1352 KB Output is correct
3 Correct 3 ms 1356 KB Output is correct
4 Correct 2 ms 1356 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 2 ms 1356 KB Output is correct
7 Correct 2 ms 1356 KB Output is correct
8 Correct 2 ms 1356 KB Output is correct
9 Correct 2 ms 1348 KB Output is correct
10 Correct 2 ms 1352 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 2 ms 1356 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 3 ms 1356 KB Output is correct
15 Correct 3 ms 1356 KB Output is correct
16 Correct 3 ms 1356 KB Output is correct
17 Correct 2 ms 1356 KB Output is correct
18 Correct 2 ms 1356 KB Output is correct
19 Correct 2 ms 1352 KB Output is correct
20 Correct 2 ms 1352 KB Output is correct
21 Incorrect 2 ms 1344 KB Output isn't correct
22 Halted 0 ms 0 KB -