結果
問題 |
No.8009 異なる数字の最大の範囲(勉強会用)
|
ユーザー |
![]() |
提出日時 | 2015-03-12 02:41:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 633 ms |
コンパイル使用メモリ | 80,452 KB |
実行使用メモリ | 8,320 KB |
最終ジャッジ日時 | 2024-06-12 22:27:53 |
合計ジャッジ時間 | 1,699 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 14 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; int main(){ int N; cin >> N; vector<int> A(N); for(int i=0; i<N; i++){ cin >> A[i]; } set<int> s; int ans = 0; int l = 0; // [l, r] for(int r=0; r<N; r++){ auto itr = s.find( A[r] ); if(itr != s.end()){ s.clear(); l = r; } s.insert( A[r] ); ans = max(ans, r-l + 1); } cout << ans << endl; return 0; }