結果
| 問題 |
No.3108 Luke or Bishop
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 00:03:30 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 824 bytes |
| コンパイル時間 | 11,197 ms |
| コンパイル使用メモリ | 388,228 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-19 00:03:48 |
| 合計ジャッジ時間 | 12,364 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 WA * 10 |
コンパイルメッセージ
warning: unnecessary braces around `if` condition
--> src/main.rs:37:8
|
37 | if { gx == 0 && gy == 0 } {
| ^^ ^^
|
= note: `#[warn(unused_braces)]` on by default
help: remove these braces
|
37 - if { gx == 0 && gy == 0 } {
37 + if gx == 0 && gy == 0 {
|
warning: constant `DIRS` is never used
--> src/main.rs:3:7
|
3 | const DIRS: [(isize, isize); 4] = [(0, 1), (1, 0), (0, -1), (-1, 0)];
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: trait `OrdExt` is never used
--> src/main.rs:5:7
|
5 | trait OrdExt {
| ^^^^^^
ソースコード
use proconio::{fastout, input};
const DIRS: [(isize, isize); 4] = [(0, 1), (1, 0), (0, -1), (-1, 0)];
trait OrdExt {
fn chmax(&mut self, other: Self) -> bool;
fn chmin(&mut self, other: Self) -> bool;
}
impl<T: Ord> OrdExt for T {
fn chmax(&mut self, other: Self) -> bool {
if *self < other {
*self = other;
true
} else {
false
}
}
fn chmin(&mut self, other: Self) -> bool {
if *self > other {
*self = other;
true
} else {
false
}
}
}
#[fastout]
fn main() {
input! {
gx: isize,
gy: isize,
}
if { gx == 0 && gy == 0 } {
println!("0");
} else if gx.abs() == gy.abs() {
println!("1");
} else {
println!("2");
}
}