結果
| 問題 | No.3731 Kaleidoscope |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 14:46:56 |
| 言語 | Rust (1.97.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 37 ms / 2,000 ms |
| + 30µs | |
| コード長 | 4,728 bytes |
| 記録 | |
| コンパイル時間 | 4,689 ms |
| コンパイル使用メモリ | 208,856 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2026-09-19 14:47:28 |
| 合計ジャッジ時間 | 10,184 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
コンパイルメッセージ
warning: unexpected `cfg` condition value: `local`
--> src/main.rs:238:7
|
238 | #[cfg(feature="local")]
| ^^^^^^^^^^^^^^^ help: remove the condition
|
= note: no expected values for `feature`
= help: consider adding `local` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `local`
--> src/main.rs:240:11
|
240 | #[cfg(not(feature="local"))]
| ^^^^^^^^^^^^^^^ help: remove the condition
|
= note: no expected values for `feature`
= help: consider adding `local` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
ソースコード
#![allow(non_snake_case,dead_code,unused_imports)]
use proconio::{*,marker::*};
fn main(){
input!{
S:Chars,
}
let n=(1<<10)-1;
let mut a=vec![vec![0;n];n];
for i in 1..n{
a[0][i]=1;
}
// (2,1)
for i in (2..n-2).step_by(2){
a[i][i-1]=1;
a[i][i]=1;
a[i+1][i-1]=1;
a[i+1][i]=1;
for j in i+3..n-1{
a[j][i-1]=1;
}
for j in i+2..n-1{
a[i][j]=1;
}
}
a[n-2][n-2]=1;
a[n-3][n-2]=1;
for (mut it,&c) in S.iter().enumerate(){
it+=1;
if c=='o'{
continue;
}
// it かい曲がる
if it%2==1{
let k=(it-1)/2;
a[n-2][k*2]=1;
} else{
let k=(it-2)/2;
a[k*2+1][n-2]=1;
}
}
println!("{n}");
for i in 0..n{
for j in 0..n{
print!("{}",['.','#'][a[i][j]]);
}
println!();
}
// debug!(a);
}
use itertools::*;
trait ChangeMinMax:Copy+PartialOrd{
fn chmin(&mut self,a:Self)->bool{
*self>a && {
*self=a;
true
}
}
fn chmax(&mut self,a:Self)->bool{
*self<a && {
*self=a;
true
}
}
}
impl<T:Copy+PartialOrd> ChangeMinMax for T{}
// library: https://github.com/rhoo19937/cp-lib
// LURD
const DD:[P;4]=[P{i:0,j:!0},P{i:!0,j:0},P{i:0,j:1},P{i:1,j:0}];
const DX:[P;8]=[P{i:0,j:!0},P{i:!0,j:!0},P{i:!0,j:0},P{i:!0,j:1},P{i:0,j:1},P{i:1,j:1},P{i:1,j:0},P{i:1,j:!0}];
#[derive(Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash,Default)]
struct P{
i:usize,
j:usize,
}
impl P{
fn new(i:usize,j:usize)->P{
P{i,j}
}
fn in_range(self,h:usize,w:usize)->bool{
self.i<h && self.j<w
}
fn id(self,w:usize)->usize{
self.i*w+self.j
}
fn from(id:usize,w:usize)->P{
P::new(id/w,id%w)
}
fn manh(self,p:P)->usize{
let abs_diff=|a,b|(a as i64-b as i64).abs() as usize;
abs_diff(self.i,p.i)+abs_diff(self.j,p.j)
}
fn parity(self)->bool{
(self.i^self.j)%2==1
}
fn dir(self,p:P)->usize{
if self.i==p.i{
if self.j-1==p.j{
0
} else{
assert!(self.j+1==p.j);
2
}
} else{
if self.i-1==p.i{
1
} else{
assert!(self.i+1==p.i);
3
}
}
}
}
impl std::fmt::Debug for P{
fn fmt(&self,f:&mut std::fmt::Formatter)->std::fmt::Result{
write!(f,"({}, {})",self.i,self.j)
}
}
impl std::ops::Add for P{
type Output=P;
fn add(self,a:P)->P{
P{
i:self.i+a.i,
j:self.j+a.j,
}
}
}
impl std::ops::Sub for P{
type Output=P;
fn sub(self,a:P)->P{
P{
i:self.i-a.i,
j:self.j-a.j,
}
}
}
impl std::ops::Mul<usize> for P{
type Output=P;
fn mul(self,a:usize)->P{
P{
i:self.i*a,
j:self.j*a,
}
}
}
impl std::ops::Div<usize> for P{
type Output=P;
fn div(self,a:usize)->P{
P{
i:self.i/a,
j:self.j/a,
}
}
}
impl std::ops::Neg for P{
type Output=P;
fn neg(self)->P{
P{
i:self.i.wrapping_neg(),
j:self.j.wrapping_neg(),
}
}
}
macro_rules! impl_p_ops{
($t:ty,$assign_trait:ident,$assign_func:ident,$op:tt)=>{
impl std::ops::$assign_trait<$t> for P{
fn $assign_func(&mut self,a:$t){
*self=*self $ op a;
}
}
}
}
impl_p_ops!(P,AddAssign,add_assign,+);
impl_p_ops!(P,SubAssign,sub_assign,-);
impl_p_ops!(usize,MulAssign,mul_assign,*);
impl_p_ops!(usize,DivAssign,div_assign,/);
macro_rules! impl_p_index{
($t:ty)=>{
impl<T:std::ops::Index<usize>> std::ops::Index<P> for $t{
type Output=T::Output;
fn index(&self,idx:P)->&T::Output{
&self[idx.i][idx.j]
}
}
impl<T:std::ops::IndexMut<usize>> std::ops::IndexMut<P> for $t{
fn index_mut(&mut self,idx:P)->&mut T::Output{
&mut self[idx.i][idx.j]
}
}
}
}
impl_p_index!([T]);
impl_p_index!(Vec<T>);
fn iterp(h:usize,w:usize)->impl Iterator<Item=P>{
(0..h).map(move|i|(0..w).map(move|j|P::new(i,j))).flatten()
}
#[cfg(feature="local")]
include!(concat!(env!("HOME"), "/cp/lib/debug_mod.rs"));
#[cfg(not(feature="local"))]
#[macro_export]macro_rules! debug{($($t:tt)*)=>{}}