답안 #833414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833414 2023-08-22T05:27:57 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
1000 ms 596 KB
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int n;
int a[100005], b[100005];

int count(int l, int r){
	int mx = -1;
	for(int i=l; i<=r; i++) mx = max(mx, a[i]);
	int cnt = 0;
	for(int i=l; i<=r; i++){
		if(mx == b[i]) cnt++;
	}
	return cnt;
}

int f(int now){
	if(now <= 0) return 0;
	int ret = 0;
	for(int i=now; i>=1; i--){
		ret = max(ret, f(i-1)+count(i, now));
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	for(int i=1; i<=n; i++) cin>>b[i];
	cout<<f(n)<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1071 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 -