結果
| 問題 | No.592 括弧の対応 (2) | 
| コンテスト | |
| ユーザー |  Bantako | 
| 提出日時 | 2018-05-27 21:42:14 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 278 ms / 5,000 ms | 
| コード長 | 430 bytes | 
| コンパイル時間 | 6,918 ms | 
| コンパイル使用メモリ | 172,536 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-30 07:22:05 | 
| 合計ジャッジ時間 | 3,360 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 3 | 
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
            
            ソースコード
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> V(N);
    stack<int> s;
    for(int i = 0;i < N;i++){
        if(S[i] == '(')s.push(i);
        else{
            int num = s.top();
            s.pop();
            V[num] = i;
            V[i] = num;
        }
    }
    for(auto i:V)cout << i+1 << endl;
}
            
            
            
        