Submission #833190

#TimeUsernameProblemLanguageResultExecution timeMemory
833190vjudge1Exam (eJOI20_exam)C++17
0 / 100
4 ms468 KiB
#include <bits/stdc++.h> using namespace std; const int MX = 2005; 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 mx = H[i]; map<int,int> cnt; cnt[T[i]]++; for(int j = i - 1; j >= 0; j--) { dp[i] = max(dp[i], dp[j] + cnt[mx]); mx = max(mx, H[j]); cnt[T[j]]++; } cnt.clear(); } cout << dp[N] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...