Submission #00073
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include<bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio( false ); int l; cin>>l; int c,ans=0; set< int > s; stack< int > st; bool b=1; int i=1,t,tt; while (b&&i<=l){ cin>>c; if (c>0){ if (s.count(c)){ ans=i; b=0; } else { s.insert(c); st.push(c); } } else { c*=-1; if (!s.count(c)){ ans=i; b=0; } else { tt=st.top(); if (c==tt){ s.erase(c); st.pop(); } else { ans=i; b=0; } } } i++; } if (ans!=0){ cout<<ans<< "\n" ; } else { cout<< "OK" << "\n" ; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - ボゾソート |
ユーザー名 | Hell World |
投稿日時 | 2021-09-10 17:06:21 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 965 Byte |
最大実行時間 | 94 ms |
最大メモリ使用量 | 15804 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 6 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | WA | 23 ms | 476 KB |
1
|
in2.txt | WA | 30 ms | 596 KB |
1
|
in3.txt | WA | 16 ms | 560 KB |
1
|
in4.txt | WA | 23 ms | 644 KB |
1
|
in5.txt | WA | 16 ms | 596 KB |
1
|
in6.txt | WA | 16 ms | 552 KB |
1
|
in7.txt | WA | 21 ms | 632 KB |
1
|
in8.txt | WA | 27 ms | 588 KB |
1
|
in9.txt | WA | 20 ms | 544 KB |
1
|
in10.txt | WA | 94 ms | 15792 KB |
1
|
in11.txt | WA | 80 ms | 15804 KB |
1
|
in12.txt | WA | 78 ms | 15696 KB |
1
|
in13.txt | WA | 74 ms | 15712 KB |
1
|
in14.txt | WA | 78 ms | 15724 KB |
1
|
in15.txt | WA | 74 ms | 15740 KB |
1
|
in16.txt | WA | 82 ms | 15760 KB |
1
|
in17.txt | WA | 78 ms | 15780 KB |
1
|
in18.txt | WA | 23 ms | 560 KB |
1
|
in19.txt | WA | 20 ms | 640 KB |
1
|
in20.txt | WA | 27 ms | 1956 KB |
1
|
in21.txt | WA | 42 ms | 3304 KB |
1
|
in22.txt | WA | 24 ms | 1260 KB |
1
|
in23.txt | WA | 49 ms | 4844 KB |
1
|
in24.txt | WA | 26 ms | 1564 KB |
1
|
in25.txt | WA | 25 ms | 1408 KB |
1
|
in26.txt | WA | 32 ms | 2156 KB |
1
|