結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-12-29 13:57:14 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 2,886 bytes | 
| コンパイル時間 | 1,218 ms | 
| コンパイル使用メモリ | 76,948 KB | 
| 最終ジャッジ日時 | 2024-11-14 19:31:50 | 
| 合計ジャッジ時間 | 1,671 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(18, 18) Error: type mismatch Expression: <624 [1] 624: int Expected one of (first mismatch at [position]): [1] proc `<`(a, b: DateTime): bool [1] proc `<`(a, b: Duration): bool [1] proc `<`(a, b: Time): bool [1] proc `<`(x, y: bool): bool [1] proc `<`(x, y: char): bool [1] proc `<`(x, y: float): bool [1] proc `<`(x, y: float32): bool [1] proc `<`(x, y: int16): bool [1] proc `<`(x, y: int32): bool [1] proc `<`(x, y: int8): bool [1] proc `<`(x, y: pointer): bool [1] proc `<`(x, y: string): bool [1] proc `<`(x, y: uint): bool [1] proc `<`(x, y: uint16): bool [1] proc `<`(x, y: uint32): bool [1] proc `<`(x, y: uint64): bool [1] proc `<`(x, y: uint8): bool [1] proc `<`[A](s, t: HashSet[A]): bool [1] proc `<`[Enum: enum](x, y: Enum): bool [1] proc `<`[T: tuple](x, y: T): bool [1] proc `<`[T](x, y: ptr T): bool [1] proc `<`[T](x, y: ref T): bool [1] proc `<`[T](x, y: set[T]): bool [2] proc `<`(x, y: int): bool [2] proc `<`(x, y: int64): bool
ソースコード
import strutils, sequtils, math, sets, times
var start = cpuTime()
const
  N: int = 624
  M: int = 397
  MATRIX_A:   cuint = 0x9908b0df.cuint
  UPPER_MASK: cuint = 0x80000000.cuint
  LOWER_MASK: cuint = 0x7fffffff.cuint
var
  mt = newSeq[cuint](0)
  mti: int = N + 1
proc init_genrand(s: cuint) =
  mt.add(s and 0xffffffff.cuint)
  for mti in 1.. <N:
    mt.add(1812433253.cuint * (mt[mti-1] xor (mt[mti-1] shr 30)).cuint + mti.cuint)
    mt[mti] = mt[mti] and 0xffffffff.cuint
proc init_by_array(init_key: seq[cuint]) =
  var key_length = init_key.len
  init_genrand(19921223)
  var
    i = 1
    j = 0
    k = if N > key_length: N else: key_length
  while k > 0:
    mt[i] = (mt[i] xor ((mt[i-1] xor (mt[i-1] shr 30)) * 1664525.cuint)) + init_key[j].cuint + j.cuint
    mt[i] = mt[i] and 0xffffffff.cuint
    i += 1
    j += 1
    if i >= N:
      mt[0] = mt[N-1]
      i = 1
    if j >= key_length:
      j = 0
    k -= 1
  for k in countdown(N-1, 1):
    mt[i] = (mt[i] xor ((mt[i-1] xor (mt[i-1] shr 30)) * 1566083941.cuint)) - i.cuint
    mt[i] = mt[i] and 0xffffffff.cuint
    i += 1
    if i >= N:
      mt[0] = mt[N-1]
      i = 1
  mt[0] = 0x80000000.cuint
proc genrand_int32():cuint =
  var y: cuint
  var mag01 = newSeq[cuint](2)
  mag01[0] = 0x0
  mag01[1] = MATRIX_A
  if mti.int >= N:
    if mti == N+1:
      init_genrand(5489)
    for kk in 0.. N-M-1:
      y = (mt[kk] and UPPER_MASK) or (mt[kk+1] and LOWER_MASK)
      mt[kk] = mt[kk+M] xor (y shr 1) xor mag01[(y and 0x1).int]
    for kk in N-M.. N-2:
      y = (mt[kk] and UPPER_MASK) or (mt[kk+1] and LOWER_MASK)
      mt[kk] = mt[kk+(M-N)] xor (y shr 1) xor mag01[(y and 0x1).int]
    y = (mt[N-1] and UPPER_MASK) or (mt[0] and LOWER_MASK)
    mt[N-1] = mt[M-1] xor (y shr 1) xor mag01[(y and 0x1).int]
    mti = 0
  y = mt[mti.int]
  mti += 1
  y = y xor (y shr 11)
  y = y xor (y shl 7) and 0x9d2c5680.cuint
  y = y xor (y shl 15) and 0xefc60000.cuint
  y = y xor (y shr 18)
  return y
proc genrand_int31():int =
  return (genrand_int32() shr 1).int
proc myrand:int = return genrand_int31()
proc shuffle*(arr: var seq) =
    var koko: int = arr.len
    for i in 0.. <koko:
        let j = genrand_int31() mod koko
        swap arr[i], arr[j]
proc shuffled*(arr: var seq):seq =
    result = arr
    shuffle(result)
###
var init = newSeq[cuint](0)
init.add(1234)
init.add(2345)
init.add(3456)
init.add(7809)
init.add(1131)
init.add(epochTime().cuint)
init_by_array(init)
var
  n = stdin.readLine.parseInt
  a = stdin.readLine.split.map(parseInt)
  b = stdin.readLine.split.map(parseInt)
  check: int = 0
  all:   int = 0
while cpuTime() - start < 4.8:
  all += 1
  var A = shuffled(a)
  var B = shuffled(b)
  var
    win:  int = 0
    lose: int = 0
  for ele in zip(A, B):
    if ele.a > ele.b:
      win += 1
    elif ele.a < ele.b:
      lose += 1
  if win > lose:
    check += 1
echo check / all
            
            
            
        