Submission #469248

#TimeUsernameProblemLanguageResultExecution timeMemory
469248ala2Nekameleoni (COCI15_nekameleoni)C++14
0 / 140
3096 ms27832 KiB
#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; cout<<" "; for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl; } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...