結果
問題 | No.2608 Divide into two |
ユーザー |
|
提出日時 | 2024-07-25 11:06:15 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 417 bytes |
コンパイル時間 | 14,657 ms |
コンパイル使用メモリ | 384,000 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-25 11:06:31 |
合計ジャッジ時間 | 15,962 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 |
ソースコード
use std::io::Read;fn a(n: usize) {let mut c = vec!['0'; n];let (mut a, mut b) = (0, 0);for i in (1..=n).rev() {if a > b {b += i} else {c[i - 1] = '1';a += i}}let s: String = c.iter().collect();println!("{}", if a == b { &s } else { "-1" })}fn main() {let mut s = String::new();std::io::stdin().read_to_string(&mut s).ok();s.lines().skip(1).flat_map(str::parse).for_each(a)}