Submission #844077

# Submission time Handle Problem Language Result Execution time Memory
844077 2023-09-05T06:47:13 Z Acanikolic Exam (eJOI20_exam) C++14
0 / 100
1000 ms 604 KB
#include <bits/stdc++.h>

#define int long long 

using namespace std;

signed main() {
	
	int n;
	cin >> n;
	vector<int>a(n+1),b(n+1);
	for(int i=1;i<=n;i++) cin >> a[i];
	for(int i=1;i<=n;i++) cin >> b[i];
	int res = 0;
	for(int l=1;l<=n;l++) {
		for(int r=l;r<=n;r++) {
			int pre = 0,posle = 0,cnt = 0;
			for(int j=1;j<l;j++) if(a[j] == b[j]) pre += 1;
			for(int j=r+1;j<=n;j++) if(a[j] == b[j]) posle += 1;
			int mx = 0;
			for(int j=l;j<=r;j++) mx = max(mx,a[j]);
			for(int j=l;j<=r;j++) if(b[j] == mx) cnt += 1;
			res = max(res,pre+posle+cnt);
		}
	}
	cout << res;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 538 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -