Submission #1019980

#TimeUsernameProblemLanguageResultExecution timeMemory
1019980coolboy19521Exam (eJOI20_exam)C++17
0 / 100
1 ms604 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...