Skip to main content

DIRECTIONS_4

Constant DIRECTIONS_4 

Source
pub const DIRECTIONS_4: [(isize, isize); 4];
Expand description

4近傍への (行, 列) オフセットを、右、上、左、下の順に表します。

行番号が下向きに増える一般的な配列座標系を想定しています。

§Examples

use atcoder::grid::DIRECTIONS_4;

let (row, col) = (2_isize, 3_isize);
let right = (row + DIRECTIONS_4[0].0, col + DIRECTIONS_4[0].1);
assert_eq!(right, (2, 4));