提交时间:2024-04-26 16:27:00
运行 ID: 46175
#include<iostream> using namespace std; int main() { int n,m; cin>>n>>m; int n1,m1,n2,m2; int ans=0; cin>>n1>>m1>>n2>>m2; ans=n+m-2; ans=min(ans,(n1+m1-2)+(n+m-n2-m2)); ans=min(ans,(n2+m2-2)+(n+m-n1-m1)); cout<<ans; return 0; }