結果
問題 | No.592 括弧の対応 (2) |
ユーザー | Lapinpon |
提出日時 | 2017-11-10 22:38:19 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 261 ms / 5,000 ms |
コード長 | 349 bytes |
コンパイル時間 | 520 ms |
コンパイル使用メモリ | 61,704 KB |
実行使用メモリ | 4,600 KB |
最終ジャッジ日時 | 2023-08-16 03:18:27 |
合計ジャッジ時間 | 1,870 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 258 ms
4,424 KB |
testcase_02 | AC | 261 ms
4,600 KB |
testcase_03 | AC | 254 ms
4,376 KB |
ソースコード
#include <iostream> #include <string> #include <stack> using namespace std; int main(){ int n,a[200000]; string s; stack <int> b; cin>>n>>s; for(int i=0;i<n;i++){ if(s[i]=='('){ b.push(i); } else { a[i]=b.top(); a[b.top()]=i; b.pop(); } } for(int i=0;i<n;i++) cout<<a[i]+1<<endl; return 0; }