結果
| 問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
| ユーザー |
👑 |
| 提出日時 | 2021-12-08 09:20:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 447 bytes |
| コンパイル時間 | 712 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-06-12 22:38:37 |
| 合計ジャッジ時間 | 3,252 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 RE * 11 |
ソースコード
#include <iostream>
#include <set>
#include <queue>
using namespace std;
int main(){
int n;cin>>n;
set<int> A;
queue<int> B;
int ans = 0;
for(int i = 0; n > i; i++){
int x;cin>>x;
if(A.count(x)){
while(B.front() != x){
B.pop();
}
B.pop();
}
B.push(x);
A.insert(x);
ans = max(ans,(int)B.size());
}
cout << ans << endl;
}