Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)B(SET)
Posted ldudxy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)B(SET)相关的知识,希望对你有一定的参考价值。
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int a[2007];
set<int>s;
int main()
int n;
cin>>n;
int iend=n+1;
for(int i=1;i<=n;++i)
cin>>a[i];
while(iend>1&&!s.count(a[iend-1]))
s.insert(a[--iend]);
int ans=9999;
for(int i=1;iend<=n+1;++iend)
while(i<iend&&!s.count(a[i]))
s.insert(a[i++]);
ans=min(ans,iend-i);
s.erase(a[iend]);
cout<<ans;
return 0;
以上是关于Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)B(SET)的主要内容,如果未能解决你的问题,请参考以下文章
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-C. Magic Grid-构造
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) C. Magic Grid
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)B(SET)
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) (1208F,1208G,1208H)