Architecture
Topic links: https://nanti.jisuanke.com/t/43465
This is very difficult when the subject of the question, of course, finally did not understand, read other people's explanations stairs can understand, I feel suddenly.
Title effect: in fact, the first line gives the maximum value for each row of the row r, column c gives the maximum value of the second row of each column, it determines whether a conflict exists.
Title Analysis: Found maximum inside from each row, and then find the smallest maximum value is obtained from each of the columns in a column. If the two are equal, then that meet the conditions, otherwise it does not meet the criteria. The problem is really very simple to read later.
code show as below:
1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int n,m; 5 int a[110],b[110]; 6 int main() 7 { 8 cin>>n>>m; 9 int maxl=-1; 10 int maxr=-1; 11 for(int i=1;i<=n;i++) 12 { 13 cin>>a[i]; 14 maxl=max(maxl,a[i]); 15 } 16 for(int i=1;i<=m;i++) 17 { 18 cin>>b[i]; 19 maxr=max(maxr,b[i]); 20 } 21 if(maxl==maxr) 22 { 23 cout<<"possible"<<endl; 24 } 25 else 26 { 27 cout<<"impossible"<<endl; 28 } 29 return 0; 30 }