結果
問題 | No.437 cwwゲーム |
ユーザー | kei |
提出日時 | 2018-12-16 00:46:54 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,705 bytes |
コンパイル時間 | 19,944 ms |
コンパイル使用メモリ | 379,284 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 06:20:16 |
合計ジャッジ時間 | 18,705 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,812 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,944 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 1 ms
6,940 KB |
testcase_21 | AC | 1 ms
6,944 KB |
testcase_22 | AC | 1 ms
6,940 KB |
testcase_23 | AC | 1 ms
6,944 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 1 ms
6,944 KB |
testcase_28 | AC | 1 ms
6,940 KB |
testcase_29 | AC | 1 ms
6,940 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,944 KB |
testcase_32 | AC | 1 ms
6,944 KB |
testcase_33 | AC | 1 ms
6,944 KB |
testcase_34 | AC | 1 ms
6,944 KB |
testcase_35 | AC | 1 ms
6,944 KB |
testcase_36 | AC | 1 ms
6,944 KB |
testcase_37 | AC | 1 ms
6,940 KB |
testcase_38 | AC | 1 ms
6,940 KB |
testcase_39 | AC | 1 ms
6,944 KB |
testcase_40 | AC | 1 ms
6,940 KB |
testcase_41 | WA | - |
testcase_42 | AC | 1 ms
6,940 KB |
testcase_43 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
warning: denote infinite loops with `loop { ... }` --> src/main.rs:29:5 | 29 | while true{ | ^^^^^^^^^^ help: use `loop` | = note: `#[warn(while_true)]` on by default
ソースコード
#![allow(unused_mut, non_snake_case,unused_imports)] use std::iter; use std::cmp::{max, min, Ordering}; use std::mem::{swap}; use std::collections::{HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap,VecDeque}; use std::iter::FromIterator; // 高速 EOF要 //macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};} //macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};} //macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};} // 低速 EOF不要 macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};} macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};} macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};} /* <url:> 問題文============================================================ ================================================================= 解説============================================================= ================================================================ */ fn main(){ input!(S:chars); let S:Vec<char> = S; let mut used = vec![false;S.len()]; let mut ans = 0; while true{ let mut update = false; let mut ii=0; let mut jj=0; let mut kk=0; let mut maxv = 0; for i in 0..S.len(){ if used[i] { continue; } for j in i+1..S.len(){ if used[j] { continue; } if S[i] == S[j] { continue; } for k in j+1..S.len(){ if used[k] { continue; } if S[i] == S[j] { continue; } if S[j] != S[k] { continue; } update = true; let v = 100*(S[i] as usize - '0' as usize) + 10*(S[j] as usize - '0' as usize) + (S[k] as usize - '0' as usize); if maxv < v{ maxv = v; ii = i; jj = j; kk = k; } } } } if !update {break;} used[ii] = true; used[jj] = true; used[kk] = true; ans += maxv; } println!("{:?}",ans); }