ホームに戻る
2次元配列の回転

// 時計周りに90度回転

// vector<vector<ll> > & v;
void rotv(vector<vector<ll> > &v){
  ll h = v.sz;
  ll w = v[0].sz;
  vector<vector<ll> > v1(w,vector<ll>(h));
  rep(y,0,h){
    rep(x,0,w){
      v1[x][h-1-y] = v[y][x];
    }
  }
  v = v1;
}

// vector<string> vs;
void rots(vector<string> &vs){
  ll h = vs.sz;
  ll w = vs[0].sz;
  vector<string> vs1(w,string(h,' '));
  rep(y,0,h){
    rep(x,0,w){
      vs1[x][h-1-y] = vs[y][x];
    }
  }
  vs = vs1;
}
inserted by FC2 system