Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int secv[1005][1005],n,k;
- int main()
- {
- int lin,x,col,ok,pi,pj,pas,aux;
- cin>>n>>k;
- ok=0;
- lin=col=1;
- aux=k;
- k=n/k;
- for(int i=1;i<=n;i++)
- {
- cin>>x;
- secv[lin][col]=x;
- col++;
- if(i%k==0)
- {
- lin++;
- col=1;
- }
- }
- for(int i=1;i<aux && !ok;i++)
- for(int j=i+1;j<=aux && !ok;j++)
- {
- for(pas=1;secv[i][pas]>0 && secv[j][pas]>0 && secv[i][pas]==secv[j][pas];pas++)
- ;
- if(secv[i][pas]==0 && secv[j][pas]==0)
- {
- ok=true;
- pi=i;
- pj=j;
- }
- }
- cout<<pi<<" "<<pj<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment