이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#define int long long
using namespace std;
const int sz = 15;
int a[sz], b[sz];
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1; i <= n; i ++)
cin >> a[i];
for (int i = 1; i <= n; i ++)
cin >> b[i];
int an = 0;
for (int i = 0; i < (1 << n); i ++) {
int k = 0;
int c = 0;
for (int j = 0; j < n; j = k) {
int tm = 0 < (i & (1 << j));
int mx = 0;
for (; k < n; k ++) {
int r = 0 < (i & (1 << k));
if (r != tm) break;
mx = max(mx, a[k+1]);
}
for (int l = j; l < k; l ++)
if (b[l+1] == mx) c ++;
}
an = max(an, c);
}
cout << an << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |