結果

問題 No.5017 Tool-assisted Shooting
ユーザー tamura-uptamura-up
提出日時 2023-07-21 04:27:40
言語 Rust
(1.77.0)
結果
RE  
実行時間 -
コード長 3,300 bytes
コンパイル時間 2,599 ms
コンパイル使用メモリ 152,384 KB
実行使用メモリ 24,468 KB
スコア 74,830
平均クエリ数 400.56
最終ジャッジ日時 2023-07-21 04:27:53
合計ジャッジ時間 12,377 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 61 ms
24,216 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 67 ms
23,604 KB
testcase_18 AC 62 ms
23,568 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 63 ms
23,976 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 62 ms
23,412 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 60 ms
23,376 KB
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 62 ms
23,520 KB
testcase_47 RE -
testcase_48 AC 67 ms
23,436 KB
testcase_49 AC 64 ms
24,060 KB
testcase_50 RE -
testcase_51 AC 61 ms
23,628 KB
testcase_52 AC 63 ms
23,412 KB
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 AC 67 ms
23,592 KB
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 AC 67 ms
23,460 KB
testcase_62 AC 67 ms
24,036 KB
testcase_63 RE -
testcase_64 RE -
testcase_65 AC 64 ms
23,964 KB
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 AC 63 ms
23,664 KB
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 RE -
testcase_83 RE -
testcase_84 RE -
testcase_85 RE -
testcase_86 RE -
testcase_87 RE -
testcase_88 RE -
testcase_89 RE -
testcase_90 RE -
testcase_91 RE -
testcase_92 AC 63 ms
23,520 KB
testcase_93 RE -
testcase_94 RE -
testcase_95 AC 64 ms
23,868 KB
testcase_96 RE -
testcase_97 RE -
testcase_98 RE -
testcase_99 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: irrefutable `while let` pattern
  --> Main.rs:78:11
   |
78 |     while let enemies=read_input(){
   |           ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this pattern will always match, so the loop will never exit
   = help: consider instead using a `loop { ... }` with a `let` inside it
   = note: `#[warn(irrefutable_let_patterns)]` on by default

warning: unused variable: `enemies`
  --> Main.rs:78:15
   |
78 |     while let enemies=read_input(){
   |               ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_enemies`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 2 warnings emitted

ソースコード

diff #

#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(non_snake_case)]

use std::fs::read;
use std::io::Write;
use std::time::Instant;

const Y: usize = 60;

// src: https://yukicoder.me/submissions/892593
//
// let x = get!(i32); // 1行の i32 の入力を受け取る
// let x = get!(i32;2); // 2行の i32 の入力を受け取る
//
// tuple
// let x = get!(i32,i32,i32); // (i32, i32, i32 )のタプルを受け取る
// let x = get!(i32,i32,i32;2); // 2行 (i32, i32, i32 )のタプルを受け取る
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}


fn read_input() -> Option<Vec<(u32, u32, usize)>> {
    let n=get!(i32);
    if n < 0{
        return None;
    }
    let mut enemies=vec![];
    for _ in 0..n{
        enemies.push(get!(u32,u32,usize));
    }

    Some(enemies)
}

fn main() {
    let mut iter=0;
    while let enemies=read_input(){
        iter+=1;
        println!("S");
        std::io::stdout().flush().unwrap();
        if iter>=1000{break;}
    }
}

// {{{
const INF: i64 = 1000_100_100;
const INFL: i64 = INF * INF;

struct Timer {
    since: Instant,
    duration: f64,
}

impl Timer {
    fn new(duration: f64) -> Timer {
        Timer {
            since: Instant::now(),
            duration,
        }
    }
    /*
     * duration 中の経過割合を返す
     * 例) duration:2.0 で経過時間:1.0 のとき, 0.5 が返される
     */
    fn t(&self) -> f64 {
        (Instant::now() - self.since).as_secs_f64() * (1.0 / self.duration)
    }

    fn left_sec(&self) -> f64 {
        self.duration - ((Instant::now() - self.since).as_secs_f64())
    }

    /* 経過時間 */
    fn sec(&self) -> f64 {
        (Instant::now() - self.since).as_secs_f64()
    }
}

/// 座標を表す構造体
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
struct P(pub usize, pub usize);


pub trait SetMinMax { fn setmin(&mut self, v: Self) -> bool; fn setmax(&mut self, v: Self) -> bool; }
impl<T> SetMinMax for T where T: PartialOrd {
    fn setmin(&mut self, v: T) -> bool { *self > v && { *self = v; true } }
    fn setmax(&mut self, v: T) -> bool { *self < v && { *self = v; true } }
}
0