結果
問題 | No.387 ハンコ |
ユーザー |
|
提出日時 | 2017-11-10 12:17:02 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 3,958 ms / 5,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 1,127 ms |
コンパイル使用メモリ | 124,316 KB |
実行使用メモリ | 31,200 KB |
最終ジャッジ日時 | 2024-06-12 22:22:08 |
合計ジャッジ時間 | 14,462 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, std.bitmanip; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!int).array; auto B = readln.split.map!(c => c == "1").array; int[][int] rev; foreach (i, a; A.enumerate) rev[a] ~= i.to!int; BitArray bs; bs.length = N * 2 - 1; foreach (i; 0..N) bs[i] = B[i]; BitArray ans; ans.length = N * 2 - 1; foreach (c; rev.keys) { BitArray tmp; tmp.length = N * 2 - 1; foreach (i; rev[c]) { BitArray bsbs = bs.dup; bsbs <<= i; tmp |= bsbs; } ans ^= tmp; } (2*N-1).iota.map!(i => ans[i] ? "ODD" : "EVEN").each!writeln; }