답안 #833478

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833478 2023-08-22T06:05:26 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 > n) return 0;
	int ret = 0;
	for(int i=now; i<=n; i++){
		ret = max(ret, count(now, i)+f(i+1));
	}
	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(1)<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1091 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 1070 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 -