結果

問題 No.3009 異なる数字の最大の範囲(勉強会用)
ユーザー yozayoza
提出日時 2015-02-28 16:59:14
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 5,264 ms
コンパイル使用メモリ 68,076 KB
実行使用メモリ 20,544 KB
最終ジャッジ日時 2023-09-03 16:48:10
合計ジャッジ時間 6,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
10,804 KB
testcase_02 AC 5 ms
10,720 KB
testcase_03 AC 4 ms
10,864 KB
testcase_04 AC 4 ms
10,844 KB
testcase_05 WA -
testcase_06 AC 4 ms
10,708 KB
testcase_07 AC 5 ms
10,824 KB
testcase_08 AC 4 ms
10,872 KB
testcase_09 AC 5 ms
10,772 KB
testcase_10 AC 4 ms
10,752 KB
testcase_11 AC 4 ms
10,928 KB
testcase_12 AC 4 ms
10,932 KB
testcase_13 AC 5 ms
10,788 KB
testcase_14 AC 5 ms
10,780 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 26 ms
20,544 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, algorithm, math


var
  n = readLine(stdin).parseInt()
  a_seq = readLine(stdin).split(' ').map(parseInt)
  inchworm = newSeq[int](1_000_002)
  right, tmp_a : int
  left, max_len = 0

for right in countup(1, n):
  tmp_a = a_seq[right - 1]
  if inchworm[tmp_a] > 0:
    left = inchworm[tmp_a]
  max_len = max(max_len, right - left)
  inchworm[tmp_a] = right

echo(max_len)
0