for(int i=1;i<=n;++i) { rc[i].first=0; rc[i].second=0; } for(int i=1;i<=n;++i) { cc[i].first=0; cc[i].second=0; }