Submission #1213022


Source Code Expand

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let n = get();
    let s: Vec<Vec<_>> = (0 .. n).map(|_| get_word().chars().collect())
        .collect();
    let t: Vec<_> = get_word().chars().collect();
    let mut pool = Vec::new();
    for i in 0 .. s.len() {
        pool.push((s[i].clone(), i));
    }
    pool.push((t, n));
    pool.sort();
    for i in 0 .. n + 1 {
        if pool[i].1 == n {
            println!("{}", i + 1);
        }
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Submission Info

Submission Time
Task A - Atcoder Handles
User kobae964
Language Rust (1.15.1)
Score 0
Code Size 1527 Byte
Status WA
Exec Time 12 ms
Memory 10620 KB

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 0 / 130 0 / 120
Status
AC × 2
WA × 1
AC × 2
WA × 4
Set Name Test Cases
Subtask1 sub1_in1.txt, sub1_in2.txt, sub1_in3.txt
Subtask2 sub1_in1.txt, sub1_in2.txt, sub1_in3.txt, sub2_in1.txt, sub2_in2.txt, sub2_in3.txt
Case Name Status Exec Time Memory
sub1_in1.txt AC 4 ms 8572 KB
sub1_in2.txt WA 4 ms 8572 KB
sub1_in3.txt AC 4 ms 8572 KB
sub2_in1.txt WA 4 ms 8572 KB
sub2_in2.txt WA 8 ms 8572 KB
sub2_in3.txt WA 12 ms 10620 KB