結果
問題 |
No.592 括弧の対応 (2)
|
ユーザー |
![]() |
提出日時 | 2018-03-26 16:40:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 266 ms / 5,000 ms |
コード長 | 692 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 87,536 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 06:48:24 |
合計ジャッジ時間 | 2,422 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { int N; cin >> N; string S; cin >> S; vector<int> V; vector<int> A(N+1); for ( int i = 0; i < N; i++ ) { if ( S[i] == '(' ) { V.push_back(i+1); } else { A[V.back()] = i+1; A[i+1] = V.back(); V.pop_back(); } } for ( int i = 1; i <= N; i++ ) { cout << A[i] << endl; } return 0; }