提交时间:2024-07-22 15:35:25
运行 ID: 158205
#include<bits/stdc++.h> using namespace std; int n, na, nb, a[210], b[210], ans1, ans2; int main(){ cin >> n >> na >> nb; for(int i = 1; i <= na; i++)cin >> a[i]; for(int i = 1; i <= nb; i++)cin >> b[i]; int k = 1, kk = 1; while(n--){ if(a[k] != b[kk]){ if(a[k] == 0){ if(b[kk] == 2 || b[kk] == 3)ans1++; else ans2++; } else if(a[k] == 1){ if(b[kk] == 0 || b[kk] == 3)ans1++; else ans2++; } else if(a[k] == 2){ if(b[kk] == 1 || b[kk] == 4)ans1++; else ans2++; } else if(a[k] == 3){ if(b[kk] == 2 || b[kk] == 4)ans1++; else ans2++; } else if(a[k] == 4){ if(b[kk] == 0 || b[kk] == 1)ans1++; else ans2++; } } k++; kk++; if(k > na)k = 1; if(kk > nb)kk = 1; } cout << ans1 << ' ' << ans2 << endl; return 0; }