結果
問題 |
No.592 括弧の対応 (2)
|
ユーザー |
|
提出日時 | 2018-06-29 10:05:05 |
言語 | C (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 28,928 KB |
実行使用メモリ | 8,864 KB |
最終ジャッジ日時 | 2024-06-30 23:44:16 |
合計ジャッジ時間 | 6,672 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 -- * 2 |
ソースコード
#include <stdio.h> int main(void) { char s[200001]; int n,i,j,l,r; scanf("%d%s",&n,s); for(i=0;i<n;i++){ l=0; r=0; if(s[i]=='('){ for(j=i+1;l+1!=r;j++){ if(s[j]=='(')l++; else r++; } } else{ for(j=i-1;l!=r+1;j--){ if(s[j]=='(')l++; else r++; } j+=2; } printf("%d\n",j); } return 0; }