Submission #38052573


Source Code Expand

use proconio::{input, fastout};
use proconio::marker::Chars;
use std::collections::VecDeque;

#[fastout]
fn main() {
    input!{
        n: usize,
        s: Chars,
        }

    for i in 1..n {
        let mut l = 0;
        while s[l] != s[l+i] {
            if (l + i < n - 1) {
                l += 1;
            } else {
                l += 1;
                break;
            }
        }
        println!("{}", l);
    }

}

Submission Info

Submission Time
Task B - Longest Uncommon Prefix
User cohsh
Language Rust (1.42.0)
Score 200
Code Size 435 Byte
Status AC
Exec Time 30 ms
Memory 2200 KiB

Compile Error

warning: unused import: `std::collections::VecDeque`
 --> src/main.rs:3:5
  |
3 | use std::collections::VecDeque;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unnecessary parentheses around `if` condition
  --> src/main.rs:15:16
   |
15 |             if (l + i < n - 1) {
   |                ^^^^^^^^^^^^^^^ help: remove these parentheses
   |
   = note: `#[warn(unused_parens)]` on by default

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 1
AC × 20
Set Name Test Cases
Sample sample_01.txt
All sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt
Case Name Status Exec Time Memory
sample_01.txt AC 6 ms 2056 KiB
test_01.txt AC 6 ms 1960 KiB
test_02.txt AC 2 ms 2100 KiB
test_03.txt AC 2 ms 2068 KiB
test_04.txt AC 2 ms 2200 KiB
test_05.txt AC 2 ms 2068 KiB
test_06.txt AC 2 ms 2132 KiB
test_07.txt AC 2 ms 1980 KiB
test_08.txt AC 3 ms 2092 KiB
test_09.txt AC 2 ms 2088 KiB
test_10.txt AC 30 ms 2104 KiB
test_11.txt AC 30 ms 2196 KiB
test_12.txt AC 2 ms 1988 KiB
test_13.txt AC 2 ms 1920 KiB
test_14.txt AC 2 ms 2132 KiB
test_15.txt AC 2 ms 2072 KiB
test_16.txt AC 2 ms 2132 KiB
test_17.txt AC 2 ms 2072 KiB
test_18.txt AC 2 ms 2200 KiB
test_19.txt AC 2 ms 2120 KiB