結果
問題 | No.592 括弧の対応 (2) |
ユーザー |
![]() |
提出日時 | 2017-02-13 00:10:56 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 22 ms / 5,000 ms |
コード長 | 336 bytes |
コンパイル時間 | 1,199 ms |
コンパイル使用メモリ | 19,456 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 17:08:15 |
合計ジャッジ時間 | 1,302 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d ",&n); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> char s[200010]; int stack[100010]; int c[200010]; int n,d,i,j; int main(){ scanf("%d ",&n); for(i=1;i<=n;++i){ int k=getchar(); if(k=='(') { stack[d++]=i; } else if(k==')') { j=stack[--d]; c[i]=j; c[j]=i; } else { break; } } for(i=1;i<=n;++i){ printf("%d\n",c[i]); } return 0; }