Submission #1763987


Source Code Expand

use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();

    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());

    let (n, m) = (it.next().unwrap(), it.next().unwrap());

    let mut v: Vec<u32> = Vec::with_capacity(n);
    for _ in 0..n {
        v.push(0);
    }
    //    println!("{}", v.len());
    for _ in 0..m {
        let mut buf = String::new();
        stdin.read_line(&mut buf).ok();
        let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
        let (a, b) = (it.next().unwrap(), it.next().unwrap());
        v[a - 1] += 1;
        v[b - 1] += 1;
    }
    //    println!("{}", v.len());

    for i in 0..v.len() {
        println!("{}", v[i]);
    }
}

Submission Info

Submission Time
Task B - Counting Roads
User nak3
Language Rust (1.15.1)
Score 200
Code Size 841 Byte
Status AC
Exec Time 2 ms
Memory 4352 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt
Case Name Status Exec Time Memory
sample_01.txt AC 2 ms 4352 KB
sample_02.txt AC 2 ms 4352 KB
sample_03.txt AC 2 ms 4352 KB
subtask_1_1.txt AC 2 ms 4352 KB
subtask_1_2.txt AC 2 ms 4352 KB
subtask_1_3.txt AC 2 ms 4352 KB
subtask_1_4.txt AC 2 ms 4352 KB
subtask_1_5.txt AC 2 ms 4352 KB
subtask_1_6.txt AC 2 ms 4352 KB
subtask_1_7.txt AC 2 ms 4352 KB