Task: | Palindromi |
Sender: | EmuBird |
Submission time: | 2024-01-20 13:28:21 +0200 |
Language: | Rust |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.00 s | details |
#2 | RUNTIME ERROR | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | RUNTIME ERROR | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | RUNTIME ERROR | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | RUNTIME ERROR | 0.00 s | details |
#12 | RUNTIME ERROR | 0.00 s | details |
#13 | RUNTIME ERROR | 0.00 s | details |
#14 | RUNTIME ERROR | 0.00 s | details |
#15 | RUNTIME ERROR | 0.00 s | details |
#16 | RUNTIME ERROR | 0.00 s | details |
#17 | RUNTIME ERROR | 0.00 s | details |
Compiler report
warning: unused import: `ops::Add` --> input/code.rs:1:22 | 1 | use std::{io::stdin, ops::Add}; | ^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused `Result` that must be used --> input/code.rs:7:9 | 7 | stdin.read_line(&mut s); | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 7 | let _ = stdin.read_line(&mut s); | +++++++ warning: 2 warnings emitted
Code
use std::{io::stdin, ops::Add}; fn main() { let stdin = stdin(); let (n, k): (usize, usize) = { let mut s = String::new(); stdin.read_line(&mut s); let mut l = s.trim_end().split_whitespace(); (l.next().unwrap().parse().unwrap(), l.next().unwrap().parse().unwrap()) }; let letters: Vec<char> = "abcdefghijklmnopqrstuvwxyz".chars().collect(); let mut palindromi = String::with_capacity(n); for i in 0..(k/2) { palindromi.insert(i, letters[i]); palindromi.insert(palindromi.len() - 1 - i, letters[i]); } if k % 2 != 0 { palindromi.insert(k / 2 + 1, letters[k / 2 + 1]); } let mut fill = String::with_capacity(n - k); for i in 0..(n - k) { fill.push(letters[i]); } println!("{}", fill.clone() + &*palindromi + &*fill) }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
1 1 |
correct output |
---|
a |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /build/rustc-wAu...
Test 2
Verdict: RUNTIME ERROR
input |
---|
2 1 |
correct output |
---|
ab |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /build/rustc-wAu...
Test 3
Verdict: ACCEPTED
input |
---|
2 2 |
correct output |
---|
aa |
user output |
---|
aa |
Test 4
Verdict: RUNTIME ERROR
input |
---|
3 1 |
correct output |
---|
abc |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /build/rustc-wAu...
Test 5
Verdict: WRONG ANSWER
input |
---|
3 2 |
correct output |
---|
aab |
user output |
---|
aaaa |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 3 |
correct output |
---|
aaa |
user output |
---|
aac |
Test 7
Verdict: RUNTIME ERROR
input |
---|
4 1 |
correct output |
---|
abca |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /build/rustc-wAu...
Test 8
Verdict: WRONG ANSWER
input |
---|
4 2 |
correct output |
---|
aabc |
user output |
---|
abaaab |
Test 9
Verdict: WRONG ANSWER
input |
---|
4 3 |
correct output |
---|
aaab |
user output |
---|
aaaca |
Test 10
Verdict: ACCEPTED
input |
---|
4 4 |
correct output |
---|
aaaa |
user output |
---|
abba |
Test 11
Verdict: RUNTIME ERROR
input |
---|
100 1 |
correct output |
---|
abcabcabcabcabcabcabcabcabcabc... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /build/rustc-wAu...
Test 12
Verdict: RUNTIME ERROR
input |
---|
100 2 |
correct output |
---|
aabcabcabcabcabcabcabcabcabcab... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...
Test 13
Verdict: RUNTIME ERROR
input |
---|
100 5 |
correct output |
---|
aaaaabcabcabcabcabcabcabcabcab... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...
Test 14
Verdict: RUNTIME ERROR
input |
---|
100 10 |
correct output |
---|
aaaaaaaaaabcabcabcabcabcabcabc... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...
Test 15
Verdict: RUNTIME ERROR
input |
---|
100 50 |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...
Test 16
Verdict: RUNTIME ERROR
input |
---|
100 90 |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...
Test 17
Verdict: RUNTIME ERROR
input |
---|
100 100 |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
user output |
---|
(empty) |
Error:
thread 'main' panicked at 'index out of bounds: the len is 26 but the index is 26', input/...