結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー | daut-dlang |
提出日時 | 2019-11-29 23:01:53 |
言語 | D (dmd 2.107.1) |
結果 |
AC
|
実行時間 | 1,139 ms / 2,000 ms |
コード長 | 2,604 bytes |
コンパイル時間 | 883 ms |
コンパイル使用メモリ | 110,036 KB |
実行使用メモリ | 227,304 KB |
最終ジャッジ日時 | 2023-09-04 03:30:06 |
合計ジャッジ時間 | 24,066 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 12 ms
4,380 KB |
testcase_01 | AC | 68 ms
21,088 KB |
testcase_02 | AC | 84 ms
20,824 KB |
testcase_03 | AC | 223 ms
60,748 KB |
testcase_04 | AC | 388 ms
70,120 KB |
testcase_05 | AC | 204 ms
59,816 KB |
testcase_06 | AC | 265 ms
60,176 KB |
testcase_07 | AC | 317 ms
64,780 KB |
testcase_08 | AC | 1,094 ms
226,308 KB |
testcase_09 | AC | 513 ms
75,524 KB |
testcase_10 | AC | 560 ms
76,436 KB |
testcase_11 | AC | 1,027 ms
222,204 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,376 KB |
testcase_16 | AC | 1 ms
4,380 KB |
testcase_17 | AC | 208 ms
4,380 KB |
testcase_18 | AC | 535 ms
76,156 KB |
testcase_19 | AC | 376 ms
60,468 KB |
testcase_20 | AC | 833 ms
85,432 KB |
testcase_21 | AC | 28 ms
5,928 KB |
testcase_22 | AC | 152 ms
23,684 KB |
testcase_23 | AC | 1 ms
4,376 KB |
testcase_24 | AC | 5 ms
4,380 KB |
testcase_25 | AC | 4 ms
4,380 KB |
testcase_26 | AC | 4 ms
4,376 KB |
testcase_27 | AC | 2 ms
4,380 KB |
testcase_28 | AC | 3 ms
4,376 KB |
testcase_29 | AC | 4 ms
4,376 KB |
testcase_30 | AC | 3 ms
4,376 KB |
testcase_31 | AC | 3 ms
4,376 KB |
testcase_32 | AC | 4 ms
4,380 KB |
testcase_33 | AC | 962 ms
221,448 KB |
testcase_34 | AC | 657 ms
79,712 KB |
testcase_35 | AC | 687 ms
79,644 KB |
testcase_36 | AC | 267 ms
62,044 KB |
testcase_37 | AC | 708 ms
85,136 KB |
testcase_38 | AC | 296 ms
61,824 KB |
testcase_39 | AC | 697 ms
79,572 KB |
testcase_40 | AC | 748 ms
81,708 KB |
testcase_41 | AC | 768 ms
82,736 KB |
testcase_42 | AC | 761 ms
84,084 KB |
testcase_43 | AC | 765 ms
82,548 KB |
testcase_44 | AC | 91 ms
20,848 KB |
testcase_45 | AC | 1,139 ms
226,916 KB |
testcase_46 | AC | 30 ms
7,244 KB |
testcase_47 | AC | 182 ms
24,604 KB |
testcase_48 | AC | 516 ms
76,488 KB |
testcase_49 | AC | 212 ms
25,152 KB |
testcase_50 | AC | 525 ms
75,868 KB |
testcase_51 | AC | 441 ms
69,808 KB |
testcase_52 | AC | 427 ms
69,688 KB |
testcase_53 | AC | 1,095 ms
227,304 KB |
testcase_54 | AC | 367 ms
68,372 KB |
testcase_55 | AC | 19 ms
6,196 KB |
testcase_56 | AC | 636 ms
78,852 KB |
testcase_57 | AC | 359 ms
66,896 KB |
testcase_58 | AC | 1 ms
4,376 KB |
testcase_59 | AC | 2 ms
4,380 KB |
コンパイルメッセージ
/dmd2/linux/bin64/../../src/phobos/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`
ソースコード
import std.stdio, std.conv, std.functional, std.string; import std.algorithm, std.array, std.container, std.range, std.typecons; import std.numeric, std.math, std.random; import core.bitop; string FMT_F = "%.10f"; static File _f; void file_io(string fn) { _f = File(fn, "r"); } static string[] s_rd; T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; } T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; } T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; } T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; } T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; } T[] RDA(T = long)(T fix = 0) { if (_f.isOpen) return _RDA!T(_f, fix); else return _RDA!T(fix); } size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;} size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; } bool inside(T)(T x, T b, T e) { return x >= b && x < e; } long lcm(long x, long y) { return x * (y / gcd(x, y)); } long mod = 10^^9 + 7; //long mod = 998244353; //long mod = 1_000_003; void moda(ref long x, long y) { x = (x + y) % mod; } void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; } void modm(ref long x, long y) { x = (x * y) % mod; } int binarySearch(alias pred, T)(in T[] arr, bool isLower = true) { int ok, ng; if (isLower) { ok = cast(int)arr.length; ng = -1; } else { ok = -1; ng = cast(int)arr.length; } while (abs(ok-ng) > 1) { auto mid = (ok+ng) / 2; if (unaryFun!pred(arr[mid])) ok = mid; else ng = mid; } return ok; } void main() { auto N = RD; auto S = RD!string; auto A = RDA; auto Q = RD; auto K = RDA; auto B = new long[2][](N+1); foreach (i; 0..N) { B[i+1][0] = B[i][0] + A[i]; B[i+1][1] = B[i][1] + (S[i] == 'E' ? 1 : 0); } long[long] set; foreach (i; 0..N) { foreach (j; i..N) { auto c = B[j+1][0] - B[i][0]; auto last = set.get(c, 0); set[c] = max(last, B[j+1][1] - B[i][1]); } } auto ans = new long[](Q); auto keys = set.keys; keys.sort(); foreach (i; 0..Q) { auto p = keys.binarySearch!((long x) => x > K[i])(); if (p == 0) continue; auto pp = keys[0..p].MIN_POS!((long a, long b) => set[a] > set[b])(); ans[i] = set[keys[pp]]; } foreach (e; ans) writeln(e); stdout.flush; debug readln; }