제출 #1129293

#제출 시각아이디문제언어결과실행 시간메모리
1129293cutimeoExam (eJOI20_exam)C++20
0 / 100
1089 ms42000 KiB
#include<bits/stdc++.h> using namespace std; int n; int a[5005], b[5005]; int sus[5005][5005]; int f[5005]; namespace sub1{ void solve(){ for (int i = 1; i <= n; i++){ int mx = 0; map<int, int> hihi; for (int j = i; j <= n; j ++){ mx = max(mx, a[j]); hihi[b[j]] ++; sus[i][j] = hihi[mx]; } } for (int i = 1; i <= n; i ++){ for (int j = 1; j <= i; j ++){ f[i] = max(f[i], f[j - 1] + sus[j][i]); } } cout << f[n] << endl; } }; namespace sub2{ }; namespace sub4{ }; int main(){ cin >> n; for (int i = 1; i <= n; i ++){ cin >> a[i]; } for (int i = 1; i <= n; i ++){ cin >> b[i]; } sub1::solve(); }
#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...