답안 #468058

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
468058 2021-08-26T09:51:56 Z Stickfish Exam (eJOI20_exam) C++17
0 / 100
1 ms 332 KB
#include <iostream>
#include <bitset>
using namespace std;

const int MAXN = 11;
int a[MAXN];
int b[MAXN];

signed main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	for(int i = 0; i < n; ++i){
		cin >> b[i];
	}
	int ans = 0;
	for(int m = 0; m < (1 << n); ++m){
		bitset<MAXN> bs = m;
		bs[n] = 1;
		bs[0] = 1;
		int cnt = 0;
		for(int i = 0; i < n; ++i){
			if(bs[i]){
				int mx = a[i];
				for(int j = i + 1; !bs[j]; ++j)
					mx = max(mx, a[j]);
				for(int j = i; !bs[j] || j == i; ++j){
					if(mx == b[j])
						++cnt;
				}
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -