tanasaradu

Untitled

Dec 2nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int secv[1005][1005],n,k;
  5. int main()
  6. {
  7. int lin,x,col,ok,pi,pj,pas,aux;
  8. cin>>n>>k;
  9. ok=0;
  10. lin=col=1;
  11. aux=k;
  12. k=n/k;
  13. for(int i=1;i<=n;i++)
  14. {
  15. cin>>x;
  16. secv[lin][col]=x;
  17. col++;
  18. if(i%k==0)
  19. {
  20. lin++;
  21. col=1;
  22. }
  23. }
  24. for(int i=1;i<aux && !ok;i++)
  25. for(int j=i+1;j<=aux && !ok;j++)
  26. {
  27. for(pas=1;secv[i][pas]>0 && secv[j][pas]>0 && secv[i][pas]==secv[j][pas];pas++)
  28. ;
  29. if(secv[i][pas]==0 && secv[j][pas]==0)
  30. {
  31. ok=true;
  32. pi=i;
  33. pj=j;
  34. }
  35. }
  36. cout<<pi<<" "<<pj<<"\n";
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment