Submission #00081
ソースコード
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 > a; bool b=1; int cou=1,same; while (b&&cou<=l){ cin>>c; if (c>0){ if (s.count(c)){ ans=cou; b=0; } else { s.insert(c); a.push(c); } } else { c*=-1; if (!s.count(c)){ ans=cou; b=0; } else { same=a.top(); if (c==same){ s.erase(c); a.pop(); } else { ans=cou; b=0; } } } cou++; } if (ans!=0){ cout<<ans<<endl; } else { cout<< "OK" <<endl; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - ボゾソート |
ユーザー名 | ソロデュオ |
投稿日時 | 2021-09-10 17:27:02 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 977 Byte |
最大実行時間 | 87 ms |
最大メモリ使用量 | 15940 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 6 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | WA | 24 ms | 604 KB |
1
|
in2.txt | WA | 19 ms | 604 KB |
1
|
in3.txt | WA | 18 ms | 696 KB |
1
|
in4.txt | WA | 26 ms | 652 KB |
1
|
in5.txt | WA | 20 ms | 608 KB |
1
|
in6.txt | WA | 25 ms | 560 KB |
1
|
in7.txt | WA | 18 ms | 644 KB |
1
|
in8.txt | WA | 19 ms | 728 KB |
1
|
in9.txt | WA | 19 ms | 688 KB |
1
|
in10.txt | WA | 77 ms | 15924 KB |
1
|
in11.txt | WA | 85 ms | 15940 KB |
1
|
in12.txt | WA | 81 ms | 15832 KB |
1
|
in13.txt | WA | 72 ms | 15852 KB |
1
|
in14.txt | WA | 77 ms | 15868 KB |
1
|
in15.txt | WA | 75 ms | 15888 KB |
1
|
in16.txt | WA | 87 ms | 15904 KB |
1
|
in17.txt | WA | 79 ms | 15916 KB |
1
|
in18.txt | WA | 25 ms | 444 KB |
1
|
in19.txt | WA | 20 ms | 656 KB |
1
|
in20.txt | WA | 30 ms | 1964 KB |
1
|
in21.txt | WA | 43 ms | 3444 KB |
1
|
in22.txt | WA | 26 ms | 1408 KB |
1
|
in23.txt | WA | 57 ms | 4860 KB |
1
|
in24.txt | WA | 26 ms | 1580 KB |
1
|
in25.txt | WA | 23 ms | 1424 KB |
1
|
in26.txt | WA | 34 ms | 2296 KB |
1
|