# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
833484 |
2023-08-22T06:07:30 Z |
vjudge1 |
Exam (eJOI20_exam) |
C++17 |
|
1000 ms |
680 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX = 1e5 + 5;
int N;
int H[MX], T[MX], dp[MX];
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> N;
for(int i = 1; i <= N; i++) cin >> H[i];
for(int i = 1; i <= N; i++) cin >> T[i];
for(int i = 1; i <= N; i++) {
for(int j = i - 1; j >= 0; j--) {
int cnt = 0;
for(int k = j + 1; k <= N; k++) {
if(H[k] > H[i]) break;
if(T[k] == H[i]) cnt++;
dp[k] = max(dp[k], dp[j] + cnt);
}
if(H[j] > H[i]) break;
}
}
// for(int i = 1; i <= N; i++) {
// cout << dp[i] << " ";
// }
// cout << '\n';
cout << dp[N] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1065 ms |
468 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
21 ms |
340 KB |
Output is correct |
3 |
Execution timed out |
1045 ms |
340 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1095 ms |
680 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |