Submission #39158940
Source Code Expand
use proconio::input;
fn main() {
input! {
x: i64,
y: i64,
};
let mut min = 1_i64 << 60;
for &b1 in &[false, true] {
for &b2 in &[false, true] {
let mut a = x;
let mut b = y;
let mut count = 0;
if b1 {
a *= -1;
count += 1;
}
if b2 {
b *= -1;
count += 1;
}
if a <= b {
min = min.min(b - a + count);
}
}
}
println!("{}", min);
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Simple Calculator |
| User | bouzuya |
| Language | Rust (1.42.0) |
| Score | 300 |
| Code Size | 573 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 2112 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_00.txt, 0_01.txt, 0_02.txt |
| All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_00.txt | AC | 7 ms | 1944 KiB |
| 0_01.txt | AC | 3 ms | 1888 KiB |
| 0_02.txt | AC | 4 ms | 2032 KiB |
| 1_00.txt | AC | 2 ms | 2012 KiB |
| 1_01.txt | AC | 1 ms | 2024 KiB |
| 1_02.txt | AC | 2 ms | 1944 KiB |
| 1_03.txt | AC | 2 ms | 2004 KiB |
| 1_04.txt | AC | 1 ms | 1992 KiB |
| 1_05.txt | AC | 1 ms | 2036 KiB |
| 1_06.txt | AC | 2 ms | 2040 KiB |
| 1_07.txt | AC | 1 ms | 2112 KiB |
| 1_08.txt | AC | 1 ms | 2100 KiB |
| 1_09.txt | AC | 1 ms | 2012 KiB |
| 1_10.txt | AC | 2 ms | 2112 KiB |