# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
124209 | 2019-07-02T16:47:01 Z | AyaBenSaad | Boat (APIO16_boat) | C++14 | 2000 ms | 8392 KB |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int M = 5e2 + 2; const int N = 1e2 + 6; int n, a[M], b[M]; set <int> s; vector <int> v; map <pair <int, int>, int> dp; int solve (int id, int last) { if (id >= n) return (last != 0 ? 1 : 0); int &ret = dp[{id,last}]; if (ret != 0) return ret; ret = solve(id+1, last); for (int i = max (a[id], last+1); i <= b[id]; i++) { ret = (1ll*ret + 1ll*solve (id+1, i)) % MOD; } return ret; } int main () { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d %d", &a[i], &b[i]); s.insert (a[i]); s.insert (b[i]); } for (int i : s) { v.push_back(i); } printf("%d\n", solve (0, 0)); } //1 2 //2 3
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 8184 KB | Output is correct |
2 | Correct | 63 ms | 8188 KB | Output is correct |
3 | Correct | 62 ms | 8312 KB | Output is correct |
4 | Correct | 63 ms | 8184 KB | Output is correct |
5 | Correct | 61 ms | 8184 KB | Output is correct |
6 | Correct | 81 ms | 8312 KB | Output is correct |
7 | Correct | 84 ms | 8312 KB | Output is correct |
8 | Correct | 86 ms | 8312 KB | Output is correct |
9 | Correct | 82 ms | 8184 KB | Output is correct |
10 | Correct | 84 ms | 8248 KB | Output is correct |
11 | Correct | 84 ms | 8312 KB | Output is correct |
12 | Correct | 83 ms | 8312 KB | Output is correct |
13 | Correct | 86 ms | 8312 KB | Output is correct |
14 | Correct | 82 ms | 8312 KB | Output is correct |
15 | Correct | 85 ms | 8392 KB | Output is correct |
16 | Correct | 14 ms | 2552 KB | Output is correct |
17 | Correct | 14 ms | 2780 KB | Output is correct |
18 | Correct | 14 ms | 2680 KB | Output is correct |
19 | Correct | 14 ms | 2808 KB | Output is correct |
20 | Correct | 13 ms | 2556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 8184 KB | Output is correct |
2 | Correct | 63 ms | 8188 KB | Output is correct |
3 | Correct | 62 ms | 8312 KB | Output is correct |
4 | Correct | 63 ms | 8184 KB | Output is correct |
5 | Correct | 61 ms | 8184 KB | Output is correct |
6 | Correct | 81 ms | 8312 KB | Output is correct |
7 | Correct | 84 ms | 8312 KB | Output is correct |
8 | Correct | 86 ms | 8312 KB | Output is correct |
9 | Correct | 82 ms | 8184 KB | Output is correct |
10 | Correct | 84 ms | 8248 KB | Output is correct |
11 | Correct | 84 ms | 8312 KB | Output is correct |
12 | Correct | 83 ms | 8312 KB | Output is correct |
13 | Correct | 86 ms | 8312 KB | Output is correct |
14 | Correct | 82 ms | 8312 KB | Output is correct |
15 | Correct | 85 ms | 8392 KB | Output is correct |
16 | Correct | 14 ms | 2552 KB | Output is correct |
17 | Correct | 14 ms | 2780 KB | Output is correct |
18 | Correct | 14 ms | 2680 KB | Output is correct |
19 | Correct | 14 ms | 2808 KB | Output is correct |
20 | Correct | 13 ms | 2556 KB | Output is correct |
21 | Execution timed out | 2059 ms | 3392 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2053 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 8184 KB | Output is correct |
2 | Correct | 63 ms | 8188 KB | Output is correct |
3 | Correct | 62 ms | 8312 KB | Output is correct |
4 | Correct | 63 ms | 8184 KB | Output is correct |
5 | Correct | 61 ms | 8184 KB | Output is correct |
6 | Correct | 81 ms | 8312 KB | Output is correct |
7 | Correct | 84 ms | 8312 KB | Output is correct |
8 | Correct | 86 ms | 8312 KB | Output is correct |
9 | Correct | 82 ms | 8184 KB | Output is correct |
10 | Correct | 84 ms | 8248 KB | Output is correct |
11 | Correct | 84 ms | 8312 KB | Output is correct |
12 | Correct | 83 ms | 8312 KB | Output is correct |
13 | Correct | 86 ms | 8312 KB | Output is correct |
14 | Correct | 82 ms | 8312 KB | Output is correct |
15 | Correct | 85 ms | 8392 KB | Output is correct |
16 | Correct | 14 ms | 2552 KB | Output is correct |
17 | Correct | 14 ms | 2780 KB | Output is correct |
18 | Correct | 14 ms | 2680 KB | Output is correct |
19 | Correct | 14 ms | 2808 KB | Output is correct |
20 | Correct | 13 ms | 2556 KB | Output is correct |
21 | Execution timed out | 2059 ms | 3392 KB | Time limit exceeded |
22 | Halted | 0 ms | 0 KB | - |