結果
| 問題 |
No.592 括弧の対応 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-12 17:02:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 591 bytes |
| コンパイル時間 | 416 ms |
| コンパイル使用メモリ | 60,096 KB |
| 実行使用メモリ | 11,168 KB |
| 最終ジャッジ日時 | 2024-11-24 23:14:57 |
| 合計ジャッジ時間 | 18,833 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | TLE * 3 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool isBlank(string &s){
for (int i=0;i<s.length();i++){
if (s[i]!=' '){
return false;
}
}
return true;
}
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;
i++;
}else if (s[i]==')'){
aw[LeftIndex]=i;
aw[i]=LeftIndex;
s[LeftIndex]=' ';
s[i]=' ';
sLen-=2;
i=0;
}else{
i++;
}
}
for (i=0;i<aw.size();i++){
cout<<aw[i]+1<<endl;
}
return 0;
}