fork(1) download
  1. #include <stdio.h>
  2. void nhapMang(int s[],int n)
  3. {
  4. for(int i=0; i<n; i++)
  5. {
  6. scanf("%d",&s[i]);
  7. }
  8. }
  9. int main(void) {
  10. int n,x;
  11. scanf("%d%d",&n,&x);
  12. int s[100],q[100];
  13. nhapMang(s,n);
  14. nhapMang(q,n);
  15. for(int i=0;i<n;i++)
  16. {
  17. for(int y=-x;y<=x;y++)
  18. if(s[i]==q[i+y])
  19. {
  20. printf("%d ",i);
  21. break;
  22. }
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5376KB
stdin
5 2
-1 2 -1 1 -1 
3 -2 -1 1 2 
stdout
0 2 3 4