# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
111409 | 2019-05-15T10:14:12 Z | ecasdqina | Boat (APIO16_boat) | C++14 | 6 ms | 4480 KB |
#include <bits/stdc++.h> using namespace std::literals::string_literals; using i64 = long long; using std::cout; using std::endl; using std::cin; template<typename T> std::vector<T> make_v(size_t a){return std::vector<T>(a);} template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){ return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); } int main() { int n; scanf("%d", &n); std::vector<int> a(n), b(n); for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]); const int MOD = 1e9 + 7; auto dp = make_v<i64>(n + 1, n + 1); dp[0][0] = 1; for(int i = 0; i < n; i++) { assert(a[i] == b[i]); for(int j = 0; j < i + 1; j++) dp[i + 1][j] = dp[i][j]; for(int j = 0; j < i + 1; j++) { if(j and a[j - 1] >= a[i]) continue; dp[i + 1][i + 1] += dp[i][j]; dp[i + 1][i + 1] %= MOD; } } i64 ans = 0; for(int i = 1; i < dp[n].size(); i++) (ans += dp[n][i]) %= MOD; printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2432 KB | Output is correct |
2 | Correct | 4 ms | 2304 KB | Output is correct |
3 | Correct | 4 ms | 2304 KB | Output is correct |
4 | Correct | 5 ms | 2304 KB | Output is correct |
5 | Correct | 5 ms | 2304 KB | Output is correct |
6 | Correct | 6 ms | 2304 KB | Output is correct |
7 | Correct | 5 ms | 2304 KB | Output is correct |
8 | Correct | 5 ms | 2304 KB | Output is correct |
9 | Correct | 5 ms | 2304 KB | Output is correct |
10 | Correct | 5 ms | 2304 KB | Output is correct |
11 | Correct | 5 ms | 2304 KB | Output is correct |
12 | Correct | 5 ms | 2304 KB | Output is correct |
13 | Correct | 5 ms | 2304 KB | Output is correct |
14 | Correct | 5 ms | 2304 KB | Output is correct |
15 | Correct | 5 ms | 2304 KB | Output is correct |
16 | Correct | 4 ms | 2304 KB | Output is correct |
17 | Correct | 4 ms | 2304 KB | Output is correct |
18 | Correct | 4 ms | 2304 KB | Output is correct |
19 | Correct | 5 ms | 2304 KB | Output is correct |
20 | Correct | 5 ms | 2304 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2432 KB | Output is correct |
2 | Correct | 4 ms | 2304 KB | Output is correct |
3 | Correct | 4 ms | 2304 KB | Output is correct |
4 | Correct | 5 ms | 2304 KB | Output is correct |
5 | Correct | 5 ms | 2304 KB | Output is correct |
6 | Correct | 6 ms | 2304 KB | Output is correct |
7 | Correct | 5 ms | 2304 KB | Output is correct |
8 | Correct | 5 ms | 2304 KB | Output is correct |
9 | Correct | 5 ms | 2304 KB | Output is correct |
10 | Correct | 5 ms | 2304 KB | Output is correct |
11 | Correct | 5 ms | 2304 KB | Output is correct |
12 | Correct | 5 ms | 2304 KB | Output is correct |
13 | Correct | 5 ms | 2304 KB | Output is correct |
14 | Correct | 5 ms | 2304 KB | Output is correct |
15 | Correct | 5 ms | 2304 KB | Output is correct |
16 | Correct | 4 ms | 2304 KB | Output is correct |
17 | Correct | 4 ms | 2304 KB | Output is correct |
18 | Correct | 4 ms | 2304 KB | Output is correct |
19 | Correct | 5 ms | 2304 KB | Output is correct |
20 | Correct | 5 ms | 2304 KB | Output is correct |
21 | Runtime error | 5 ms | 4480 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 640 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2432 KB | Output is correct |
2 | Correct | 4 ms | 2304 KB | Output is correct |
3 | Correct | 4 ms | 2304 KB | Output is correct |
4 | Correct | 5 ms | 2304 KB | Output is correct |
5 | Correct | 5 ms | 2304 KB | Output is correct |
6 | Correct | 6 ms | 2304 KB | Output is correct |
7 | Correct | 5 ms | 2304 KB | Output is correct |
8 | Correct | 5 ms | 2304 KB | Output is correct |
9 | Correct | 5 ms | 2304 KB | Output is correct |
10 | Correct | 5 ms | 2304 KB | Output is correct |
11 | Correct | 5 ms | 2304 KB | Output is correct |
12 | Correct | 5 ms | 2304 KB | Output is correct |
13 | Correct | 5 ms | 2304 KB | Output is correct |
14 | Correct | 5 ms | 2304 KB | Output is correct |
15 | Correct | 5 ms | 2304 KB | Output is correct |
16 | Correct | 4 ms | 2304 KB | Output is correct |
17 | Correct | 4 ms | 2304 KB | Output is correct |
18 | Correct | 4 ms | 2304 KB | Output is correct |
19 | Correct | 5 ms | 2304 KB | Output is correct |
20 | Correct | 5 ms | 2304 KB | Output is correct |
21 | Runtime error | 5 ms | 4480 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Halted | 0 ms | 0 KB | - |