# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
833472 |
2023-08-22T06:00:41 Z |
vjudge1 |
Exam (eJOI20_exam) |
C++17 |
|
18 ms |
392 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++) {
int cntLeft = 0;
for(int j = i - 1; j >= 0; j--) {
int cntRight = 0;
for(int k = i; k <= N; k++) {
if(H[k] > H[i]) break;
if(T[k] == H[i]) cntRight++;
dp[k] = max(dp[k], dp[j] + cntRight + cntLeft);
}
if(H[j] > H[i]) break;
if(T[j] == H[i]) cntLeft++;
}
}
for(int i = 1; i <= N; i++) {
cout << dp[i] << " ";
}
cout << '\n';
cout << dp[N] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |