# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
446418 | 2021-07-21T21:35:36 Z | radaiosm7 | Exam (eJOI20_exam) | C++ | 2 ms | 332 KB |
#include <bits/stdc++.h> using namespace std; int n, a[5005], b[5005], i, j, dp[5005], cc; int main() { scanf("%d", &n); for (i=1; i <= n; ++i) { scanf("%d", &a[i]); } for (i=1; i <= n; ++i) { scanf("%d", &b[i]); } dp[0] = 0; for (i=1; i <= n; ++i) { cc = 0; dp[i] = 0; for (j=i; j > 0; --j) { if (a[j] > a[i]) break; if (b[j] == a[i]) ++cc; dp[i] = max(dp[i], dp[j-1]+cc); } } printf("%d\n", dp[n]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |