| Task: | Palindromi |
| Sender: | ma100 |
| Submission time: | 2025-10-28 11:17:00 +0200 |
| Language: | Rust (2021) |
| 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 | RUNTIME ERROR | 0.00 s | details |
| #4 | RUNTIME ERROR | 0.00 s | details |
| #5 | RUNTIME ERROR | 0.00 s | details |
| #6 | RUNTIME ERROR | 0.00 s | details |
| #7 | RUNTIME ERROR | 0.00 s | details |
| #8 | RUNTIME ERROR | 0.00 s | details |
| #9 | RUNTIME ERROR | 0.00 s | details |
| #10 | RUNTIME ERROR | 0.00 s | details |
Code
use std::io::{self, Read};
fn main() {
let mut regs: [u32; 26] = [0; 26];
let mut left_over = String::with_capacity(0x80);
let mut total_input = String::with_capacity(0xff);
io::stdin().read_to_string(&mut total_input).expect("read stdin error");
let mut total_input = total_input.split("\n");
loop {
let mut input = left_over.clone();
// Read a new line if too little data is available
if left_over.split_ascii_whitespace().count() < 2 {
let mut buf = input.clone();
buf.push_str(match total_input.next() {
Some(s) => s,
None => break,
});
let mut buf = buf.trim();
match buf.find("#") {
Some(i) => buf = &buf[..i],
None => {},
};
if buf.is_empty() {
continue;
}
input = buf.to_string();
}
let mut input = input.split_ascii_whitespace();
let instr = input.next().expect("too few arguments");
left_over.push_str(instr);
left_over.push(' ');
let reg = match input.next() {
Some(s) => s,
None => continue,
};
left_over.push_str(reg);
left_over.push(' ');
let reg: usize = (reg.as_bytes()[0] - 65).into();
match instr {
"CLEAR" => regs[reg] = 0,
"INCREASE" => regs[reg] += 1,
"PRINT" => println!("{}", regs[reg]),
_ => panic!("illegal instruction '{instr}'"),
}
left_over = String::with_capacity(0x80);
for member in input {
left_over.push_str(member);
left_over.push(' ');
}
}
}
Test details
Test 1 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| datatahti |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'datatahti' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 2 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| saippuakauppias |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'saippuakauppias' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 3 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| a |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'a' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 4 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| aa |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'aa' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 5 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| abc |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'abc' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 6 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| aybabtu |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'aybabtu' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 7 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| abacabaca |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'abacabaca' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 8 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| bbbbaaaababbbbbaabaaabaaaaabab... |
| correct output |
|---|
| 23 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'bbbbaaaababbbbbaabaaabaaaaababaaabbaaabbabbaabbbaaaaababababaabaaabbaaabbbbaaabaaabaaabababbabbabaaa' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 9 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| acbaaabaabaddaccdcccbcdbdddacd... |
| correct output |
|---|
| 38 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'acbaaabaabaddaccdcccbcdbdddacdcddaadddbbcbbbdaccdadbbbdddacbaacadccddabaaadbdcccdcdaacdcbbbbaadababb' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Test 10 (public)
Verdict: RUNTIME ERROR
| input |
|---|
| uaqtmfftecryanvpshxsodjrllqnqp... |
| correct output |
|---|
| 49 |
| user output |
|---|
| (empty) |
Error:
thread 'main' panicked at input/code.rs:46:18: illegal instruction 'uaqtmfftecryanvpshxsodjrllqnqpunxichcvbqovfwjthwiewmzwpivtdtdlwbkioipatbbhcvepukdoswafxivrdggsapvlmh' note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
