1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| #include<bits/stdc++.h> using namespace std; int n,x,y,k[1007],kk[1007],m,p[1007],tmp; bool fl1,fl2;
void init(){ memset(k,0,sizeof(k)); memset(p,0,sizeof(p)); } int main(){ init(); cin>>n>>x>>y; for(int i=1;i<=n;i++){ cin>>k[i]; } cin>>m; for(int i=1;i<=m;i++){ cin>>p[i]; }
fl1=fl2=true; x<y?tmp=1:tmp=0; if(x+m>n) fl1=false; if(x-m<=0) fl2=false; for (int i = x+1, j = 1; i <= n && j <= m; i++, j++) { if (k[i] != p[j]) { fl1 = false; break; } } for (int i = x-1, j = 1; i >0 && j <= m; i--, j++) { if (k[i] != p[j]) { fl2 = false; break; } }
if(fl1&&fl2){ cout<<"Unsure"<<endl; } else if(tmp&&fl1||!tmp&&fl2){ cout<<"Right"<<endl; } else{ cout<<"Wrong"<<endl; } }
|