# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
636812 | 2022-08-30T08:58:44 Z | lovrot | Boat (APIO16_boat) | C++11 | 3 ms | 2372 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = 510; const int MOD = 1e9 + 7; ll add(ll x, ll y){ return (x + y) % MOD; } int n, a[N], b[N]; ll dp[N][N]; ll DP(int x, int last){ if(x > n) return 1; if(dp[x][last] != -1) return dp[x][last]; dp[x][last] = DP(x + 1, last); if(a[last] < a[x]) dp[x][last] = add(dp[x][last], DP(x + 1, x)); return dp[x][last]; } int main(){ memset(dp, -1, sizeof(dp)); scanf("%d", &n); for(int i = 1; i <= n; i++){ scanf("%d%d", &a[i], &b[i]); } printf("%d\n", DP(1, 0) - 1); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2260 KB | Output is correct |
2 | Correct | 3 ms | 2348 KB | Output is correct |
3 | Correct | 2 ms | 2260 KB | Output is correct |
4 | Correct | 3 ms | 2260 KB | Output is correct |
5 | Correct | 3 ms | 2260 KB | Output is correct |
6 | Correct | 2 ms | 2260 KB | Output is correct |
7 | Correct | 3 ms | 2260 KB | Output is correct |
8 | Correct | 3 ms | 2260 KB | Output is correct |
9 | Correct | 3 ms | 2260 KB | Output is correct |
10 | Correct | 3 ms | 2260 KB | Output is correct |
11 | Correct | 3 ms | 2260 KB | Output is correct |
12 | Correct | 3 ms | 2372 KB | Output is correct |
13 | Correct | 3 ms | 2260 KB | Output is correct |
14 | Correct | 3 ms | 2260 KB | Output is correct |
15 | Correct | 2 ms | 2260 KB | Output is correct |
16 | Correct | 3 ms | 2348 KB | Output is correct |
17 | Correct | 3 ms | 2260 KB | Output is correct |
18 | Correct | 3 ms | 2260 KB | Output is correct |
19 | Correct | 3 ms | 2348 KB | Output is correct |
20 | Correct | 2 ms | 2260 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2260 KB | Output is correct |
2 | Correct | 3 ms | 2348 KB | Output is correct |
3 | Correct | 2 ms | 2260 KB | Output is correct |
4 | Correct | 3 ms | 2260 KB | Output is correct |
5 | Correct | 3 ms | 2260 KB | Output is correct |
6 | Correct | 2 ms | 2260 KB | Output is correct |
7 | Correct | 3 ms | 2260 KB | Output is correct |
8 | Correct | 3 ms | 2260 KB | Output is correct |
9 | Correct | 3 ms | 2260 KB | Output is correct |
10 | Correct | 3 ms | 2260 KB | Output is correct |
11 | Correct | 3 ms | 2260 KB | Output is correct |
12 | Correct | 3 ms | 2372 KB | Output is correct |
13 | Correct | 3 ms | 2260 KB | Output is correct |
14 | Correct | 3 ms | 2260 KB | Output is correct |
15 | Correct | 2 ms | 2260 KB | Output is correct |
16 | Correct | 3 ms | 2348 KB | Output is correct |
17 | Correct | 3 ms | 2260 KB | Output is correct |
18 | Correct | 3 ms | 2260 KB | Output is correct |
19 | Correct | 3 ms | 2348 KB | Output is correct |
20 | Correct | 2 ms | 2260 KB | Output is correct |
21 | Incorrect | 2 ms | 2260 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2260 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2260 KB | Output is correct |
2 | Correct | 3 ms | 2348 KB | Output is correct |
3 | Correct | 2 ms | 2260 KB | Output is correct |
4 | Correct | 3 ms | 2260 KB | Output is correct |
5 | Correct | 3 ms | 2260 KB | Output is correct |
6 | Correct | 2 ms | 2260 KB | Output is correct |
7 | Correct | 3 ms | 2260 KB | Output is correct |
8 | Correct | 3 ms | 2260 KB | Output is correct |
9 | Correct | 3 ms | 2260 KB | Output is correct |
10 | Correct | 3 ms | 2260 KB | Output is correct |
11 | Correct | 3 ms | 2260 KB | Output is correct |
12 | Correct | 3 ms | 2372 KB | Output is correct |
13 | Correct | 3 ms | 2260 KB | Output is correct |
14 | Correct | 3 ms | 2260 KB | Output is correct |
15 | Correct | 2 ms | 2260 KB | Output is correct |
16 | Correct | 3 ms | 2348 KB | Output is correct |
17 | Correct | 3 ms | 2260 KB | Output is correct |
18 | Correct | 3 ms | 2260 KB | Output is correct |
19 | Correct | 3 ms | 2348 KB | Output is correct |
20 | Correct | 2 ms | 2260 KB | Output is correct |
21 | Incorrect | 2 ms | 2260 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |