結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-10-30 01:10:16 |
| 言語 | Haskell (9.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 534 bytes |
| 記録 | |
| コンパイル時間 | 1,094 ms |
| コンパイル使用メモリ | 194,816 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-04 03:27:15 |
| 合計ジャッジ時間 | 2,022 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 4 RE * 10 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU
-- http://yukicoder.me/problems/19
import Data.Bits
main = do
n <- readLn
w <- getLine
putStrLn $ main' n w
main' n ws =
let
w = map read $ words ws
s = foldl1 (+) w `div` 2
a = zip [1..n] w
x = shiftL (1::Int) n
in
solve s (x - 1) a
solve _ 0 _ = "impossible"
solve n x a =
if n == foldl calc x a
then "possible"
else solve n (x - 1) a
calc x (i,e) = if testBit i x then e else 0