結果
| 問題 | No.59 鉄道の旅 |
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-08-02 19:56:57 |
| 言語 | Nim (2.2.8) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 931 bytes |
| 記録 | |
| コンパイル時間 | 554 ms |
| コンパイル使用メモリ | 65,408 KB |
| 最終ジャッジ日時 | 2026-03-19 19:00:52 |
| 合計ジャッジ時間 | 1,186 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(14, 39) Error: tuple expected for tuple unpacking, but got 'seq[int]'
ソースコード
import strutils,sequtils,math
const
x21 = 1 shl 21
x20 = 1 shl 20
var
N,K : int
flag : array[100001,int]
nimotu = newSeq[int](0)
BIT : array[x21,int]
cnt,w,index : int
(N,K) = stdin.readline.strip.split.map(parseInt)
proc hantei(i : int):bool=
var
j = i
cnt = BIT[i]
while (j and (j + 1)) > 0:
if (j and 1) == 1:
j = (j + 1) shr 1
cnt += BIT[j]
else:
j += 1
cnt += BIT[j]
return cnt < K
for n in 1..N:
w = stdin.readline.parseInt
if w > 0:
index = x20 + w
if hantei(index):
while index > 0:
BIT[index] += 1
index = index shr 1
cnt += 1
else:
index = x20 - w
if BIT[index] > 0:
while index > 0:
BIT[index] -= 1
index = index shr 1
cnt -= 1
echo cnt
6soukiti29