結果

問題 No.5017 Tool-assisted Shooting
ユーザー tamura-up
提出日時 2023-07-21 04:33:01
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 2,471 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 146,120 KB
実行使用メモリ 24,372 KB
スコア 74,830
平均クエリ数 399.74
最終ジャッジ日時 2023-07-21 04:33:16
合計ジャッジ時間 11,841 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `enemies`
  --> Main.rs:78:20
   |
78 |     while let Some(enemies)=read_input(){
   |                    ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_enemies`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 1 warning 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 Some(enemies)=read_input(){
        iter+=1;
        println!("S");
        std::io::stdout().flush().unwrap();
        if iter>=1000{break;}
    }
}

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