結果
| 問題 |
No.592 括弧の対応 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-12 17:11:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 569 ms |
| コンパイル使用メモリ | 61,240 KB |
| 実行使用メモリ | 11,172 KB |
| 最終ジャッジ日時 | 2024-11-24 23:15:06 |
| 合計ジャッジ時間 | 8,251 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
string s;
int sLen;
cin>>sLen;
cin>>s;
vector<int> aw(sLen,0);
int i=0;
int LeftIndex=0;
while (sLen>0){
if (s[i]=='('){
LeftIndex=i;
}else if (s[i]==')'){
aw[LeftIndex]=i;
aw[i]=LeftIndex;
s[LeftIndex]=' ';
s[i]=' ';
sLen-=2;
while (LeftIndex>0 && s[LeftIndex]==' '){
LeftIndex--;
}
}
i++;
}
for (i=0;i<aw.size();i++){
cout<<aw[i]+1<<endl;
}
return 0;
}