結果

問題 No.1205 Eye Drops
ユーザー Konton7Konton7
提出日時 2020-08-30 13:17:30
言語 Rust
(1.77.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,821 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 151,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 13:21:05
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 3 ms
4,380 KB
testcase_34 AC 3 ms
4,376 KB
testcase_35 AC 3 ms
4,376 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 9 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: fields `mark`, `y`, and `x` are never read
  --> Main.rs:38:5
   |
37 | struct Piece {
   |        ----- fields in this struct
38 |     mark: char,
   |     ^^^^
39 |     y: i32,
   |     ^
40 |     x: i32,
   |     ^
   |
   = note: `Piece` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
   = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

ソースコード

diff #

#[allow(unused_imports)]
use std::cmp;
use std::fs::File;
use std::io::Read;
#[allow(unused_imports)]
use std::mem;

#[allow(dead_code)]
fn pow_speedy_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 {
    p %= m;
    let mut r = p;
    let mut ret: i64 = 1;
    while q > 0 {
        ret *= if q % 2 == 1 { r } else { 1 };
        r *= r;
        r %= m;
        q /= 2;
        ret %= m;
    }
    return ret;
}

#[allow(dead_code)]
fn comb(n: usize, k: usize, m: i64, frac: &[i64], frac_inv: &[i64]) -> i64 {
    let mut ret = 1i64;
    if n < k {
        return 0;
    }
    ret *= frac[n] * frac_inv[n - k];
    ret %= m;
    ret *= frac_inv[k];
    ret %= m;
    ret
}

#[derive(Debug)]
struct Piece {
    mark: char,
    y: i32,
    x: i32,
}

fn main() {
    let inputstatus = 1;

    let mut buf = String::new();
    let filename = "inputrust.txt";

    if inputstatus == 0 {
        let mut f = File::open(filename).expect("file not found");
        f.read_to_string(&mut buf)
            .expect("something went wrong reading the file");
    } else {
        std::io::stdin().read_to_string(&mut buf).unwrap();
    }

    let mut iter = buf.split_whitespace();

    let _: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let mut ans = true;

    let mut t = 0i64;
    let mut x = 0i64;

    for _ in 0..m {
        let ti: i64 = iter.next().unwrap().parse().unwrap();
        let xi: i64 = iter.next().unwrap().parse().unwrap();
        if (ti - t) < (x - xi).abs() {
            ans = false;
            break;
        }
        t = ti;
        x = xi;
    }

    let ans = if ans { "Yes" } else { "No" };
    println!("{}", ans);

    // let n = iter.next().unwrap().parse().unwrap();

    // println!("{}", n);
    // println!("{:?}", cum_num);
}
0