Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
509 B
1
Indexable
Never
#include<iostream>
using namespace std;
int fr1[21]={0}, fr2[21]={0};
int main()
{ int v[50][50], n, m, i, j, ok=0;
  cin>>m>>n;
  
  for(i=1;i<=m;i++) {
      
      for(j=1;j<=n;j++)
         cin>>v[i][j];
        
      if(j==1) fr1[v[i][j]]++;
            
            else if(j==n) fr2[v[i][j]]++; 
  }
    
    
    for(i=1;i<=20;i++) {
        
        if(fr1[i]==1 && fr2[i]==1)
         { cout<<i<<" ";
           ok=1;}
     
        
    }
    
    if(ok==0) cout<<"NU EXISTA";
    
    return 0;
}