# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1086331 | 2024-09-10T07:52:11 Z | mar | Exam (eJOI20_exam) | C++14 | 20 ms | 876 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 100008; ll dp[maxn]; int main() { int n; cin>>n; int ans=0; vector<int> a, b; bool flag = true; int inp; for(int i=0;i<n;i++) { cin>>inp; a.push_back(inp); } for(int i=0;i<n;i++){ cin>>inp; b.push_back(inp); } vector<int> v; map<int, int> idx; for(int i=0; i<n; i++) idx[a[i]] = i; for(int i=0; i<n; i++) { if(idx.count(b[i]) && i <= idx[b[i]]) v.push_back(b[i]); } ll mx = 0; ll sz = v.size(); for (int i=0; i<sz; i++) { for(int j=0; j<i; j++) { if(v[i] >= v[j]) { dp[i] = max(dp[i], dp[j]+1); } } } for(int i=0; i<sz; i++) { mx = max(mx,dp[i]); } cout<<mx+1<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 4 ms | 604 KB | Output is correct |
4 | Correct | 20 ms | 856 KB | Output is correct |
5 | Correct | 7 ms | 604 KB | Output is correct |
6 | Correct | 8 ms | 860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 876 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 4 ms | 604 KB | Output is correct |
10 | Correct | 20 ms | 856 KB | Output is correct |
11 | Correct | 7 ms | 604 KB | Output is correct |
12 | Correct | 8 ms | 860 KB | Output is correct |
13 | Incorrect | 0 ms | 348 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |