提交时间:2024-07-18 10:37:27
运行 ID: 156676
#include <iostream> using namespace std; const int N=1e5; int n,na,nb,A,B,a[N],b[N];int MAP[5][5]={{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; int main(){ cin>>n>>na>>nb; for(int i=0;i<na;i++)cin>>a[i]; for(int j=0;j<nb;j++)cin>>b[j]; while(n--){ A+=MAP[a[n%na]][b[n%nb]]; B+=MAP[b[n%nb]][a[n%na]]; } cout<<A<<' '<<B; }