Submission #2122884
Source Code Expand
#![allow(unused_imports)] use std::io::{ self, Write }; use std::str::FromStr; use std::cmp::{ min, max }; use std::collections::{ BinaryHeap, VecDeque }; #[allow(unused_macros)] macro_rules! trace { ($var:expr) => { let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var); }; ($($args:expr),*) => { trace!(($($args),*)) } } #[allow(unused_macros)] macro_rules! put { ($var:expr) => { let _ = writeln!(&mut std::io::stdout(), "{}", $var); }; ($var:expr, $($args:expr),*) => { let _ = write!(&mut std::io::stdout(), "{} ", $var); put!($($args),*); }; } fn main() { let mut sc = Scanner::new(); let n: usize = sc.cin(); let m: usize = sc.cin(); let mut ps = vec![]; { let m_ = (m + m) as i32; for _ in 0..n { let x: i32 = sc.cin(); let y: i32 = sc.cin(); let x_ = ((x % m_) + m_) % m_; let y_ = ((y % m_) + m_) % m_; let c: char = sc.cin::<String>().chars().collect::<Vec<_>>()[0]; ps.push((x_ as usize, y_ as usize, c)); } } let mut ans = 0; for i in 0..m { for j in 0..m { let mut cx = 0; for &(x, y, c) in ps.iter() { let s = (x + i) % (m + m) < m; let t = (y + j) % (m + m) < m; if ((s == t) && c == 'B') || ((s != t) && c == 'W') { cx += 1; } } ans = max(ans, cx); ans = max(ans, n - cx); } } put!(ans); } #[allow(dead_code)] struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, } #[allow(dead_code)] impl Scanner { fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } } fn reserve(&mut self) { while self.buffer.len() == 0 { let mut line = String::new(); let _ = self.stdin.read_line(&mut line); for w in line.split_whitespace() { self.buffer.push_back(String::from(w)); } } } fn cin<T: FromStr>(&mut self) -> T { self.reserve(); match self.buffer.pop_front().unwrap().parse::<T>() { Ok(a) => a, Err(_) => panic!("parse err") } } }
Submission Info
Submission Time | |
---|---|
Task | D - Checker |
User | cympfh |
Language | Rust (1.15.1) |
Score | 0 |
Code Size | 2392 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 9348 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 2 ms | 4352 KB |
0_001.txt | AC | 41 ms | 4352 KB |
0_002.txt | AC | 2 ms | 4352 KB |
1_003.txt | AC | 22 ms | 4352 KB |
1_004.txt | AC | 2 ms | 4352 KB |
1_005.txt | AC | 2 ms | 4352 KB |
1_006.txt | AC | 2 ms | 4352 KB |
1_007.txt | AC | 2 ms | 4352 KB |
1_008.txt | AC | 22 ms | 4352 KB |
1_009.txt | AC | 2 ms | 4352 KB |
1_010.txt | AC | 2 ms | 4352 KB |
1_011.txt | AC | 3 ms | 4352 KB |
1_012.txt | AC | 231 ms | 4352 KB |
1_013.txt | TLE | 2103 ms | 4352 KB |
1_014.txt | AC | 45 ms | 9348 KB |
1_015.txt | AC | 52 ms | 9348 KB |
1_016.txt | AC | 102 ms | 9348 KB |
1_017.txt | TLE | 2103 ms | 9348 KB |
1_018.txt | TLE | 2103 ms | 9348 KB |
1_019.txt | AC | 1837 ms | 4352 KB |
1_020.txt | AC | 1836 ms | 4352 KB |
1_021.txt | AC | 1836 ms | 4352 KB |
1_022.txt | AC | 1836 ms | 4352 KB |
1_023.txt | AC | 1836 ms | 4352 KB |
1_024.txt | AC | 1836 ms | 4352 KB |
1_025.txt | AC | 274 ms | 9348 KB |
1_026.txt | TLE | 2103 ms | 9348 KB |
1_027.txt | AC | 275 ms | 9348 KB |
1_028.txt | TLE | 2103 ms | 9348 KB |
1_029.txt | AC | 273 ms | 9348 KB |
1_030.txt | TLE | 2103 ms | 9348 KB |