#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector> A(N,vector(N)); int nh=0,nw=0; int c=0;//周を管理する for(int a=1; a<=N*N; a++){ // cerr<<"start "<<"nh="<