結果
| 問題 | 
                            No.726 Tree Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             alpha_virginis
                         | 
                    
| 提出日時 | 2018-08-24 23:09:41 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,337 bytes | 
| コンパイル時間 | 12,113 ms | 
| コンパイル使用メモリ | 378,120 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-23 09:09:33 | 
| 合計ジャッジ時間 | 13,127 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 WA * 1 RE * 22 | 
ソースコード
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;
#[allow(unused_macros)]
macro_rules! tf {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}
fn is_prime(x: i64) -> bool {
    if x <= 1 {
        return false;
    }
    for i in 2i64.. {
        if i * i > x {
            break;
        }
        if x % i == 0 {
            return false;
        }
    }
    true
}
fn main() {
    assert_eq!(is_prime(2), true);
    assert_eq!(is_prime(3), true);
    assert_eq!(is_prime(4), false);
    assert_eq!(is_prime(5), true);
    assert_eq!(is_prime(6), false);
    assert_eq!(is_prime(7), true);
    let (y,x) = {
        let xs = read_vec_i64();
        (xs[0], xs[1])
    };
    assert!( 1 <= y && y <= 1_000_000_000 );
    assert!( 1 <= x && x <= 1_000_000_000 );
    assert!( y == 2 );
    //assert!( 1 <= x && x <= 10 );
    if is_prime(y) && is_prime(x) {
        println!("Second");
        return;
    }
    let y2 = {
        let mut res = y;
        for i in y+1.. {
            if is_prime(i) {
                res = i;
                break;
            }
        }
        res
    };
    let x2 = {
        let mut res = x;
        for i in x+1.. {
            if is_prime(i) {
                res = i;
                break;
            }
        }
        res
    };
    eprintln!("{}, {}", y2, x2);
    println!("{}", tf!(((y2-y)+(x2-x)) % 2 != 0, "First", "Second"));
}
#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}
#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}
#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}
use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}
            
            
            
        
            
alpha_virginis