結果
| 問題 |
No.1971 Easy Sudoku
|
| コンテスト | |
| ユーザー |
cutmdo
|
| 提出日時 | 2022-06-10 21:25:14 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,647 bytes |
| コンパイル時間 | 14,504 ms |
| コンパイル使用メモリ | 393,316 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 05:57:15 |
| 合計ジャッジ時間 | 13,507 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
コンパイルメッセージ
warning: unused variable: `v` --> src/main.rs:5:9 | 5 | let v = 0..n; | ^ help: if this is intentional, prefix it with an underscore: `_v` | = note: `#[warn(unused_variables)]` on by default
ソースコード
use std::io::Write;
/* ----------------------------------------------- */
fn run<W: Write>(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<W>) {
let n: usize = sc.next();
let v = 0..n;
for i in 0..n {
let s = (0..n)
.map(|x| ((x + i) % n + 1).to_string())
.collect::<Vec<String>>()
.join(" ");
writeln!(out, "{}", s).ok();
}
}
/* ----------------------------------------------- */
#[allow(dead_code)]
mod scanner {
use std::str::FromStr;
pub struct Scanner<'a> {
it: std::str::SplitWhitespace<'a>,
}
impl<'a> Scanner<'a> {
pub fn new(s: &'a String) -> Scanner<'a> {
Scanner {
it: s.split_whitespace(),
}
}
pub fn next<T: FromStr>(&mut self) -> T {
self.it.next().unwrap().parse::<T>().ok().unwrap()
}
pub fn next_bytes(&mut self) -> Vec<u8> {
self.it.next().unwrap().bytes().collect()
}
pub fn next_chars(&mut self) -> Vec<char> {
self.it.next().unwrap().chars().collect()
}
pub fn next_vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
(0..len).map(|_| self.next()).collect()
}
}
}
/* ----------------------------------------------- */
fn main() {
use std::io::Read;
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).unwrap();
let mut sc = scanner::Scanner::new(&s);
let out = std::io::stdout();
let mut out = std::io::BufWriter::new(out.lock());
run(&mut sc, &mut out);
}
/* ----------------------------------------------- */
cutmdo