# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
110345 | 2019-05-10T17:48:17 Z | luciocf | Exhibition (JOI19_ho_t2) | C++14 | 6 ms | 4352 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3+10; struct P { int s, v; } p[maxn]; int c[maxn]; int n, m; int dp[maxn][maxn]; bool comp(P a, P b) { return a.v < b.v; } int solve(int i, int j) { if (i == n+1 || j == m+1) return 0; if (dp[i][j] != -1) return dp[i][j]; int ans = 0; if (p[i].s <= c[j]) ans = max(ans, 1+solve(i+1, j+1)); ans = max(ans, solve(i+1, j)); ans = max(ans, solve(i, j+1)); ans = max(ans, solve(i+1, j+1)); return dp[i][j] = ans; } int main(void) { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d %d", &p[i].s, &p[i].v); for (int i = 1; i <= m; i++) scanf("%d", &c[i]); sort(p+1, p+n+1, comp); sort(c+1, c+m+1); memset(dp, -1, sizeof dp); printf("%d\n", solve(1, 1)); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4352 KB | Output is correct |
2 | Correct | 6 ms | 4352 KB | Output is correct |
3 | Incorrect | 5 ms | 4352 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4352 KB | Output is correct |
2 | Correct | 6 ms | 4352 KB | Output is correct |
3 | Incorrect | 5 ms | 4352 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4352 KB | Output is correct |
2 | Correct | 6 ms | 4352 KB | Output is correct |
3 | Incorrect | 5 ms | 4352 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |