Submission #833481

# Submission time Handle Problem Language Result Execution time Memory
833481 2023-08-22T06:06:32 Z vjudge1 Exam (eJOI20_exam) C++11
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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 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 -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 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 -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 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 -