提出 #41631362
ソースコード 拡げる
use proconio::{input, marker::Usize1};
fn main() {
input! {
n: usize,
q: usize,
}
let mut cols = (0..n).collect::<Vec<usize>>();
let mut rows = (0..n).collect::<Vec<usize>>();
let mut rotate = false;
for _ in 0..q {
input! {
t: usize,
}
match t {
1 => {
input! {
a: Usize1,
b: Usize1,
}
if rotate {
cols.swap(a, b);
} else {
rows.swap(a, b);
}
}
2 => {
input! {
a: Usize1,
b: Usize1,
}
if rotate {
rows.swap(a, b);
} else {
cols.swap(a, b);
}
}
3 => {
rotate = !rotate;
}
4 => {
input! {
a: Usize1,
b: Usize1,
}
if rotate {
println!("{}", n * rows[b] + cols[a]);
} else {
println!("{}", n * rows[a] + cols[b]);
}
}
_ => unreachable!(),
}
}
}
提出情報
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 6 / 6 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample0.txt, sample1.txt |
| All | large0.txt, large1.txt, large2.txt, large3.txt, large4.txt, large5.txt, sample0.txt, sample1.txt, small1.txt, small2.txt, small3.txt, small4.txt, small5.txt, small6.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| large0.txt | AC | 67 ms | 4504 KiB |
| large1.txt | AC | 61 ms | 4532 KiB |
| large2.txt | AC | 61 ms | 4440 KiB |
| large3.txt | AC | 65 ms | 4508 KiB |
| large4.txt | AC | 67 ms | 4384 KiB |
| large5.txt | AC | 66 ms | 4508 KiB |
| sample0.txt | AC | 4 ms | 2124 KiB |
| sample1.txt | AC | 1 ms | 2068 KiB |
| small1.txt | AC | 61 ms | 2588 KiB |
| small2.txt | AC | 56 ms | 2516 KiB |
| small3.txt | AC | 55 ms | 2616 KiB |
| small4.txt | AC | 57 ms | 2752 KiB |
| small5.txt | AC | 57 ms | 2808 KiB |
| small6.txt | AC | 57 ms | 2892 KiB |