結果
問題 | No.2566 美しい整数列 |
ユーザー | 👑 hos.lyric |
提出日時 | 2024-02-09 21:16:22 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 147 ms / 2,000 ms |
コード長 | 1,837 bytes |
コンパイル時間 | 840 ms |
コンパイル使用メモリ | 110,080 KB |
実行使用メモリ | 49,356 KB |
最終ジャッジ日時 | 2024-02-09 21:16:29 |
合計ジャッジ時間 | 6,139 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,676 KB |
testcase_01 | AC | 1 ms
6,676 KB |
testcase_02 | AC | 1 ms
6,676 KB |
testcase_03 | AC | 1 ms
6,676 KB |
testcase_04 | AC | 145 ms
49,356 KB |
testcase_05 | AC | 147 ms
41,932 KB |
testcase_06 | AC | 92 ms
25,824 KB |
testcase_07 | AC | 94 ms
27,644 KB |
testcase_08 | AC | 92 ms
32,268 KB |
testcase_09 | AC | 94 ms
31,804 KB |
testcase_10 | AC | 94 ms
31,840 KB |
testcase_11 | AC | 102 ms
35,064 KB |
testcase_12 | AC | 100 ms
30,692 KB |
testcase_13 | AC | 112 ms
35,064 KB |
testcase_14 | AC | 105 ms
30,964 KB |
testcase_15 | AC | 107 ms
31,072 KB |
testcase_16 | AC | 119 ms
38,780 KB |
testcase_17 | AC | 145 ms
41,136 KB |
testcase_18 | AC | 146 ms
40,756 KB |
testcase_19 | AC | 103 ms
30,588 KB |
testcase_20 | AC | 120 ms
41,004 KB |
testcase_21 | AC | 130 ms
40,572 KB |
testcase_22 | AC | 78 ms
26,608 KB |
testcase_23 | AC | 106 ms
28,100 KB |
ソースコード
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; } string COLOR(string s = "") { return "\x1b[" ~ s ~ "m"; } 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 M = readInt; auto A = new long[N]; foreach (i; 0 .. N) A[i] = readLong; auto B = new long[M]; foreach (i; 0 .. M) B[i] = readLong; auto C = new long[N]; foreach (i; 0 .. N) C[i] = readLong; auto tar = new long[N]; tar[0] = 0; foreach (i; 0 .. N - 1) { tar[i + 1] = tar[i] + B[i % M]; } long[long] cs; foreach (i; 0 .. N) { cs[A[i] - tar[i]] += C[i]; } long ans; ans += C.sum; ans -= cs.values.maxElement; writeln(ans); } } catch (EOFException e) { } }