結果

問題 No.592 括弧の対応 (2)
ユーザー 6soukiti296soukiti29
提出日時 2017-11-10 22:47:41
言語 Nim
(2.0.2)
結果
AC  
実行時間 269 ms / 5,000 ms
コード長 325 bytes
コンパイル時間 2,898 ms
コンパイル使用メモリ 69,176 KB
実行使用メモリ 8,128 KB
最終ジャッジ日時 2023-09-12 15:25:09
合計ジャッジ時間 4,719 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 269 ms
6,344 KB
testcase_02 AC 264 ms
8,128 KB
testcase_03 AC 264 ms
5,300 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
var
    N = stdin.readline.parseInt
    S = stdin.readline
    L = newSeq[int](0)
    l : int
    ans : array[200000, int]

for i,c in S:
    if c == '(':
        L.add(i + 1)
        
    if c == ')':
        l = L.pop()
        ans[l - 1] = i + 1
        ans[i] = l

for n in 0..<N:
    echo ans[n]
0