結果
| 問題 |
No.22 括弧の対応
|
| コンテスト | |
| ユーザー |
kazuppa
|
| 提出日時 | 2024-07-23 15:07:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 291 bytes |
| コンパイル時間 | 6,313 ms |
| コンパイル使用メモリ | 279,560 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 15:07:41 |
| 合計ジャッジ時間 | 4,440 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;string s;cin>>n>>k>>s;
stack<int> sta;vector<int> Pa(n);
for(int i=0;i<n;i++){
if(s[i]=='(')sta.push(i);
else{
int j=sta.top();sta.pop();
Pa[i]=j;
Pa[j]=i;
}
}
cout<<Pa[k-1]+1<<endl;
}
kazuppa