結果
| 問題 |
No.2843 Birthday Present Struggle
|
| コンテスト | |
| ユーザー |
tomerun
|
| 提出日時 | 2024-09-29 18:54:45 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 3,563 bytes |
| コンパイル時間 | 14,608 ms |
| コンパイル使用メモリ | 379,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-29 18:55:03 |
| 合計ジャッジ時間 | 16,279 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
コンパイルメッセージ
warning: unused variable: `n`
--> src/main.rs:140:9
|
140 | let n = sc.i32();
| ^ help: if this is intentional, prefix it with an underscore: `_n`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `ax`
--> src/main.rs:141:9
|
141 | let ax = sc.i32();
| ^^ help: if this is intentional, prefix it with an underscore: `_ax`
warning: unused variable: `ay`
--> src/main.rs:142:9
|
142 | let ay = sc.i32();
| ^^ help: if this is intentional, prefix it with an underscore: `_ay`
warning: unused variable: `bx`
--> src/main.rs:143:9
|
143 | let bx = sc.i32();
| ^^ help: if this is intentional, prefix it with an underscore: `_bx`
warning: unused variable: `by`
--> src/main.rs:144:9
|
144 | let by = sc.i32();
| ^^ help: if this is intentional, prefix it with an underscore: `_by`
ソースコード
#![allow(unused_imports)]
#![allow(dead_code)]
use std::collections::{HashMap, HashSet};
use std::io::{self, BufRead, BufReader, Read, Stdin};
use std::iter;
use std::mem;
use std::str::FromStr;
use std::string::String;
#[derive(Debug)]
pub struct Scanner<R> {
reader: BufReader<R>,
}
fn scanner() -> Scanner<Stdin> {
Scanner::new(io::stdin())
}
impl<R: io::Read> Scanner<R> {
pub fn new(read: R) -> Scanner<R> {
Scanner {
reader: BufReader::new(read),
}
}
pub fn next_str(&mut self) -> Option<String> {
let mut buf = [0; 1];
let size = self.reader.read(&mut buf).unwrap();
if size == 0 {
None
} else {
self.skip_whitespace(&mut buf)?;
let mut v = vec![buf[0]];
loop {
let size = self.reader.read(&mut buf).unwrap();
if size == 0 || buf[0].is_ascii_whitespace() {
break;
}
v.push(buf[0]);
}
Some(String::from_utf8(v).unwrap())
}
}
pub fn next_line(&mut self) -> String {
let mut line = String::new();
self.reader.read_line(&mut line).unwrap();
if let Some(s) = line.strip_suffix("\n") {
s.to_string()
} else {
line
}
}
pub fn vec<S: FromStr>(&mut self, size: i32) -> Vec<S> {
let mut v: Vec<S> = vec![];
for _ in 0..size {
let token = self.next_str().unwrap();
v.push(S::from_str(&token).ok().unwrap());
}
v
}
pub fn next_as<S: FromStr>(&mut self) -> Option<S> {
let s = self.next_str()?;
S::from_str(&s).ok()
}
pub fn str(&mut self) -> String {
self.next_str().unwrap()
}
pub fn i32(&mut self) -> i32 {
self.next_as::<i32>().unwrap()
}
pub fn u32(&mut self) -> u32 {
self.next_as::<u32>().unwrap()
}
pub fn i64(&mut self) -> i64 {
self.next_as::<i64>().unwrap()
}
pub fn u64(&mut self) -> u64 {
self.next_as::<u64>().unwrap()
}
pub fn usize(&mut self) -> usize {
self.next_as::<usize>().unwrap()
}
pub fn f32(&mut self) -> f32 {
self.next_as::<f32>().unwrap()
}
pub fn f64(&mut self) -> f64 {
self.next_as::<f64>().unwrap()
}
fn skip_whitespace(&mut self, mut buf: &mut [u8]) -> Option<u8> {
loop {
if !buf[0].is_ascii_whitespace() {
return Some(buf[0]);
}
let size = self.reader.read(&mut buf).unwrap();
if size == 0 {
return None;
}
}
}
}
fn yesno(b: bool) -> &'static str {
if b {
"Yes"
} else {
"No"
}
}
// end of library
fn solve(len: &Vec<i64>, n: usize, k: i64) -> char {
if n == 0 {
return "yuusaan".chars().nth(k as usize).unwrap();
}
let prev = len[n as usize - 1];
if k < prev {
return solve(len, n - 1, k);
}
if k < prev + 5 {
return "uusaa".chars().nth((k - prev) as usize).unwrap();
}
return solve(len, n - 1, k - prev - 5);
}
fn main() {
let mut sc = scanner();
let n = sc.i32();
let ax = sc.i32();
let ay = sc.i32();
let bx = sc.i32();
let by = sc.i32();
let cx = sc.i32();
let cy = sc.i32();
println!("{}", 4);
println!("{} {}", cx - 1, cy);
println!("{} {}", cx + 1, cy);
println!("{} {}", cx, cy - 1);
println!("{} {}", cx, cy + 1);
}
tomerun