結果
問題 | No.387 ハンコ |
ユーザー | te-sh |
提出日時 | 2017-07-25 17:18:48 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 4,938 ms / 5,000 ms |
コード長 | 983 bytes |
コンパイル時間 | 4,073 ms |
コンパイル使用メモリ | 84,728 KB |
実行使用メモリ | 22,220 KB |
最終ジャッジ日時 | 2023-09-03 15:29:59 |
合計ジャッジ時間 | 29,231 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4,929 ms
22,164 KB |
testcase_01 | AC | 4,938 ms
22,220 KB |
testcase_02 | AC | 1,070 ms
5,704 KB |
testcase_03 | AC | 1,073 ms
6,348 KB |
testcase_04 | AC | 396 ms
8,400 KB |
testcase_05 | AC | 1,523 ms
19,780 KB |
testcase_06 | AC | 2,904 ms
21,248 KB |
testcase_07 | AC | 1,095 ms
14,988 KB |
testcase_08 | AC | 1,085 ms
7,016 KB |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.bitmanip; // BitArray void main() { auto n = readln.chomp.to!size_t; auto newBitArray() { auto r = BitArray(); r.length = 2*n-1; return r; } auto a = new int[](n), rda = readln.chomp.splitter; foreach (i; 0..n) { a[i] = rda.front.to!int; rda.popFront(); } auto b = newBitArray(), rdb = readln.chomp.splitter; foreach (i; 0..n) { b[i] = rdb.front.to!int.to!bool; rdb.popFront(); } auto shift(ref BitArray ba, size_t n) { if (n > 0 && n % 64 == 0) { ba <<= 1; ba <<= n-1; } else { ba <<= n; } } size_t[][int] c; foreach (i, ai; a) c[ai] ~= i; auto r = newBitArray(); foreach (ci; c.byValue) { auto d = newBitArray(), e = b.dup, p = size_t(0); foreach (cii; ci) { shift(e, cii - p); d |= e; p = cii; } r ^= d; } foreach (i; 0..2*n-1) writeln(r[i] ? "ODD" : "EVEN"); }