結果
問題 | No.592 括弧の対応 (2) |
ユーザー |
![]() |
提出日時 | 2017-11-10 22:47:41 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 274 ms / 5,000 ms |
コード長 | 325 bytes |
コンパイル時間 | 2,629 ms |
コンパイル使用メモリ | 65,288 KB |
実行使用メモリ | 7,168 KB |
最終ジャッジ日時 | 2024-06-30 03:22:20 |
合計ジャッジ時間 | 4,110 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
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]