답안 #844077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 538 ms 440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -