This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[1001000];
int v[100];
signed main()
{
int n,m,k;
cin>>n>>k>>m;
for(int i=1;i<=n;i++)
cin>>a[i];
int mn=1e9;
for(int vv=0;vv<m;vv++)
{
int x;
cin>>x;
if(x==1)
{
int y,z;
cin>>y>>z;
a[y]=z;
}
else
{ mn=1e9;
for(int i=1;i<=n;i++)
{ //cout<<" : "<<i<<endl;
int p=0;
for(int j=i;j<=n;j++)
{
v[a[j]]++;
if(v[a[j]]==1)
p++;
if(p==k)
{ // cout<<" "<<i<<" "<<j<<endl;
mn=min(mn,j-i+1);
break;
}
}
// cout<<" "<<i<<" "<<mn<< endl;
for(int ii=0;ii<=k;ii++)
{
v[ii]=0;
}
}
if(mn==1e9)
cout<<-1<<endl;
else cout<<mn<<endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |