Submission #1019988

#TimeUsernameProblemLanguageResultExecution timeMemory
1019988coolboy19521Exam (eJOI20_exam)C++17
0 / 100
1 ms348 KiB
#include "bits/stdc++.h" #define int long long using namespace std; const int sz = 20; int a[sz], b[sz]; signed main() { cin.tie(nullptr)->sync_with_stdio(false); 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 an = 0; for (int i = 0; i < (1ll << n); i ++) { int k = 0; int c = 0; for (int j = 0; j < n; j = k) { int tm = 0 < (i & (1ll << j)); int mx = 0; for (; k < n; k ++) { int r = 0 < (i & (1ll << k)); if (r != tm) break; mx = max(mx, a[k]); } for (int l = j; l < k; l ++) if (b[l] == 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...