結果
問題 | No.941 商とあまり |
ユーザー | 👑 hos.lyric |
提出日時 | 2019-12-04 04:23:31 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,105 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 120,852 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 03:19:21 |
合計ジャッジ時間 | 17,080 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 119 ms
6,940 KB |
testcase_02 | AC | 110 ms
6,948 KB |
testcase_03 | WA | - |
testcase_04 | AC | 108 ms
6,940 KB |
testcase_05 | AC | 110 ms
6,940 KB |
testcase_06 | AC | 113 ms
6,944 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 121 ms
6,940 KB |
testcase_13 | AC | 107 ms
6,940 KB |
testcase_14 | AC | 147 ms
6,944 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 109 ms
6,944 KB |
testcase_18 | AC | 108 ms
6,940 KB |
testcase_19 | AC | 109 ms
6,944 KB |
testcase_20 | AC | 106 ms
6,940 KB |
testcase_21 | AC | 111 ms
6,944 KB |
testcase_22 | AC | 109 ms
6,944 KB |
testcase_23 | AC | 1 ms
6,940 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | AC | 1 ms
6,940 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 154 ms
6,940 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 154 ms
6,944 KB |
testcase_32 | AC | 116 ms
6,944 KB |
testcase_33 | AC | 107 ms
6,940 KB |
testcase_34 | AC | 108 ms
6,944 KB |
testcase_35 | AC | 109 ms
6,940 KB |
testcase_36 | AC | 125 ms
6,944 KB |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | AC | 112 ms
6,940 KB |
testcase_40 | AC | 108 ms
6,940 KB |
testcase_41 | AC | 109 ms
6,944 KB |
testcase_42 | AC | 109 ms
6,940 KB |
testcase_43 | AC | 112 ms
6,944 KB |
testcase_44 | WA | - |
testcase_45 | AC | 131 ms
6,940 KB |
testcase_46 | WA | - |
testcase_47 | AC | 129 ms
6,940 KB |
testcase_48 | AC | 108 ms
6,944 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 130 ms
6,940 KB |
testcase_55 | AC | 125 ms
6,940 KB |
testcase_56 | WA | - |
testcase_57 | AC | 116 ms
6,940 KB |
testcase_58 | AC | 110 ms
6,940 KB |
testcase_59 | AC | 120 ms
6,940 KB |
testcase_60 | AC | 116 ms
6,944 KB |
testcase_61 | AC | 119 ms
6,944 KB |
testcase_62 | AC | 119 ms
6,944 KB |
testcase_63 | AC | 118 ms
6,944 KB |
testcase_64 | AC | 110 ms
6,944 KB |
testcase_65 | AC | 132 ms
6,940 KB |
testcase_66 | WA | - |
testcase_67 | AC | 108 ms
6,944 KB |
testcase_68 | WA | - |
testcase_69 | AC | 113 ms
6,944 KB |
testcase_70 | AC | 130 ms
6,944 KB |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | AC | 139 ms
6,940 KB |
testcase_74 | AC | 137 ms
6,944 KB |
testcase_75 | AC | 134 ms
6,940 KB |
testcase_76 | AC | 110 ms
6,944 KB |
testcase_77 | AC | 137 ms
6,940 KB |
testcase_78 | AC | 136 ms
6,940 KB |
testcase_79 | AC | 107 ms
6,944 KB |
testcase_80 | AC | 149 ms
6,940 KB |
testcase_81 | AC | 144 ms
6,940 KB |
testcase_82 | AC | 152 ms
6,944 KB |
testcase_83 | AC | 118 ms
6,940 KB |
testcase_84 | AC | 153 ms
6,940 KB |
testcase_85 | AC | 153 ms
6,940 KB |
testcase_86 | AC | 149 ms
6,940 KB |
testcase_87 | AC | 154 ms
6,944 KB |
testcase_88 | AC | 108 ms
6,940 KB |
testcase_89 | AC | 153 ms
6,944 KB |
testcase_90 | AC | 110 ms
6,940 KB |
testcase_91 | AC | 114 ms
6,944 KB |
testcase_92 | AC | 153 ms
6,944 KB |
testcase_93 | AC | 158 ms
6,940 KB |
testcase_94 | AC | 122 ms
6,940 KB |
testcase_95 | AC | 152 ms
6,944 KB |
testcase_96 | AC | 154 ms
6,944 KB |
testcase_97 | AC | 159 ms
6,944 KB |
testcase_98 | AC | 108 ms
6,940 KB |
testcase_99 | AC | 129 ms
6,940 KB |
testcase_100 | AC | 161 ms
6,944 KB |
testcase_101 | AC | 117 ms
6,944 KB |
testcase_102 | AC | 118 ms
6,944 KB |
testcase_103 | AC | 112 ms
6,944 KB |
testcase_104 | AC | 1 ms
6,944 KB |
testcase_105 | AC | 1 ms
6,940 KB |
testcase_106 | AC | 1 ms
6,944 KB |
testcase_107 | AC | 1 ms
6,940 KB |
testcase_108 | AC | 1 ms
6,944 KB |
testcase_109 | WA | - |
ソースコード
import std.conv, std.functional, std.range, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; } int readInt() { return readToken.to!int; } long readLong() { return readToken.to!long; } real readReal() { return readToken.to!real; } bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } } bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } } int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; } int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); } int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); } void main() { try { for (; ; ) { const N = readInt(); const X = readInt(); auto A = new int[N]; foreach (i; 0 .. N) { A[i] = readInt(); } long prod = 1; foreach (i; 0 .. N) { prod *= (A[i] + 1); if (prod - 1 > X) { foreach (x; 1 .. X + 1) { write(0); } writeln(); goto failed; } } if (A[0] == 1) { foreach (x; 1 .. prod - 1) { write(0); } foreach (x; prod - 1 .. X + 1) { write(1); } goto failed; } { const lb = cast(int)(prod - 1); const m = X - lb + 1; auto ans = new bool[m]; debug { writeln("lb = ", lb, ", m = ", m); } void solve(int l, int r, bool[] dp) { if (l + 1 == r) { debug { writeln(l, ": ", dp); } foreach (x; 0 .. m) { ans[x] = ans[x] || dp[x]; } return; } const mid = (l + r) / 2; auto DP = new bool[m]; DP[] = dp[]; foreach (i; mid .. r) { foreach (x; A[i] .. m) { if (DP[x - A[i]]) { DP[x] = true; } } } solve(l, mid, DP); DP[] = dp[]; foreach (i; l .. mid) { foreach (x; A[i] .. m) { if (DP[x - A[i]]) { DP[x] = true; } } } solve(mid, r, DP); } auto dp = new bool[m]; dp[0] = true; solve(0, N, dp); foreach (x; 1 .. lb) { write(0); } foreach (x; 0 .. m) { write(ans[x] ? 1 : 0); } writeln(); } failed: } } catch (EOFException e) { } }