結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-18 07:24:10 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,489 bytes |
| コンパイル時間 | 5,699 ms |
| コンパイル使用メモリ | 86,544 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 02:52:54 |
| 合計ジャッジ時間 | 7,535 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 13 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 17) Warning: imported and not used: 'strutils' [UnusedImport]
ソースコード
import sequtils,strutils,osproc;const p = @[ """echo '{.experimental.}
import sequtils,strutils,algorithm,math,future,macros
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
let t = genSym(); result = quote do:(let `t` = `arr`;())
for i in 0..<cnt: result[0][1].add(quote do:`t`[`i`])
template times*(n:int,body) = (for _ in 0..<n: body)
# t , n^a (log n)^b 秒
# 53_300k_1.txt -> 1600 ms (parallel::3003ms...)
let
M = get().parseInt()
ABT = newSeqWith(M,get().split().map(parseFloat))
var ans = newSeq[float](M)
proc solve(m:int) =
let (a,b,t) = ABT[m].unpack(3)
proc newton(a,b,t:float): float =
result = 1.1
var lnx = ln(result)
for i in 1..25:
result -= (a*lnx + b*lnx.ln - t.ln) / ((a*lnx + b) / (result*lnx))
lnx = result.ln
ans[m] = if a == 0: exp(pow(t, 1.0/b))
elif b == 0: pow(t, 1.0/a)
else: newton(a,b,t)
template parallelDo(fn ,MIN,MAX) =
import threadpool,cpuinfo
# do fn(i) parallel :: i in [MIN..<MAX]
let STEP = max(1,(MAX - MIN) div 4)
proc solveProc(m:int) =
for mi in m..< min(m+STEP,M): fn(mi)
for m in countup(MIN,MAX,STEP):
spawn solveProc(m)
sync()
parallelDo(solve,0,M)
for m in 0..<M:
echo(($ans[m])[0..11])
' > h.nim""","nim --hints:off -o:b.out -d:release --threads:on --experimental --parallelBuild:4 c h.nim"].mapIt(it.gorge)
discard execProcess("""a="$(ls -1t ../time/ | head -1)";./b.out < ../test_in/$a > ../out/$a""")