代码如下QwQ:
#include<iostream>
using namespace std;
int n,na,nb,cntA,cntB,nowA,nowB,i;
short SPR(const int& a,const int& b){
if(a==b)return 0;
if(a==0){
if(b==1 or b==4)return -1;
if(b==2 or b==3)return 1;
}
if(a==1){
if(b==2 or b==4)return -1;
if(b==3)return 1;
}
if(a==2){
if(b==3)return -1;
if(b==4)return 1;
}
if(a==3)
if(b==4)return 1;
return -2;
}
int main(){
cin>>n>>na>>nb;
int roundA[na],roundB[nb];
for(;i<na;i++)cin>>roundA[i];
for(i=0;i<nb;i++)cin>>roundB[i];
for(i=0;i<n;i++){
if(nowA>na)nowA=0;
if(nowB>nb)nowB=0;
if(SPR(roundA[nowA],roundB[nowB])==1)cntA++;
if(SPR(roundA[nowA],roundB[nowB])==-1)cntB++;
nowA++;
nowB++;
}
cout<<cntA<<' '<<cntB;
return 0;
}