結果
| 問題 | No.3637 PANDORA |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-09-28 13:16:55 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,926 bytes |
| 記録 | |
| コンパイル時間 | 743 ms |
| コンパイル使用メモリ | 200,692 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-09-28 13:39:06 |
| 合計ジャッジ時間 | 11,790 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | -- * 2 |
| 小課題1 | 5 % | -- * 4 |
| 小課題2 | 10 % | -- * 4 |
| 小課題3 | 5 % | -- * 8 |
| 小課題4 | 10 % | -- * 5 |
| 小課題5 | 20 % | -- * 10 |
| 小課題6 | 20 % | -- * 16 |
| 小課題7 | 30 % | -- * 38 |
| 合計 | 0 点 |
ソースコード
use fio::*;
fn main() {
let [_n, q] = read_tuple::<usize, 2>();
let mut s = read_line().bytes().collect::<Vec<_>>();
for _ in 0..q {
let q = read_vec::<String>();
match q[0].as_str() {
"1" => {
let i = q[1].parse::<usize>().unwrap() - 1;
let c = q[2].bytes().next().unwrap();
s[i] = c;
}
"2" => {
let mut idx = Some(0usize);
for c in q[1].bytes() {
idx =
idx.and_then(|x| s.iter().skip(x).position(|a| *a == c).map(|v| v + x + 1))
}
println!("{}", if idx.is_some() { "Yes" } else { "No" });
}
_ => panic!(),
}
}
}
mod fio {
use std::{
cell::RefCell,
convert::TryInto,
fmt::Debug,
io::{BufRead, BufWriter, StdinLock, StdoutLock, stdin, stdout},
str::FromStr,
};
thread_local! {
pub static STDIN: RefCell<StdinLock<'static>> = RefCell::new(stdin().lock());
pub static STDOUT: RefCell<BufWriter<StdoutLock<'static>>> = RefCell::new(BufWriter::new(stdout().lock()));
}
#[allow(dead_code)]
pub fn read<T: FromStr>() -> T
where
<T as FromStr>::Err: Debug,
{
read_line().parse().unwrap()
}
/// If there is a performance concern, use direct
/// `read_line().spilt_ascii_whitespace().map(|x| x.parse().unwrap())`
#[allow(dead_code)]
pub fn read_vec<T: FromStr>() -> Vec<T>
where
<T as FromStr>::Err: Debug,
{
read_line()
.split_ascii_whitespace()
.map(|x| x.parse().unwrap())
.collect()
}
/// If there is a performance concern, use direct
/// `read_line().spilt_ascii_whitespace().map(|x| x.parse().unwrap())`
#[allow(dead_code)]
pub fn read_tuple<T, const N: usize>() -> [T; N]
where
T: FromStr + Debug,
<T as FromStr>::Err: Debug,
{
read_vec::<T>().try_into().unwrap()
}
/// whitespace at the end of the line is ignored
pub fn read_line() -> String {
let mut s = String::new();
STDIN.with(|cell| {
cell.borrow_mut().read_line(&mut s).unwrap();
});
String::from_str(s.trim_end()).unwrap()
}
}
#[macro_export]
macro_rules! print {
($($t:tt)*) => {
fio::STDOUT.with(|cell|{
use std::io::Write;
write!(cell.borrow_mut(), $($t)*).unwrap()
})};
}
#[macro_export]
macro_rules! println {
($($t:tt)*) => {
fio::STDOUT.with(|cell| {
use std::io::Write;
writeln!(cell.borrow_mut(), $($t)*).unwrap()
})
};
}
#[macro_export]
macro_rules! flush {
() => {
fio::STDOUT.with(|cell| {
use std::io::Write;
cell.borrow_mut().flush().unwrap()
});
};
}