結果

問題 No.592 括弧の対応 (2)
ユーザー kotatsugamekotatsugame
提出日時 2017-11-13 02:11:36
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 295 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 60,624 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-16 11:07:47
合計ジャッジ時間 1,956 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main()
      ^

ソースコード

diff #

#include<iostream>
#include<stack>
using namespace std;
string s;
int c[1<<18];
stack<int>P;
main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='(')
		{
			P.push(i);
		}
		else
		{
			int a=P.top();P.pop();
			c[a]=i+1,c[i]=a+1;
		}
	}
	for(int i=0;i<s.size();i++)cout<<c[i]<<endl;
}
0