Submission #469250

# Submission time Handle Problem Language Result Execution time Memory
469250 2021-08-31T08:51:51 Z ala2 Nekameleoni (COCI15_nekameleoni) C++14
0 / 140
3000 ms 1060 KB
#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
1 Correct 559 ms 204 KB Output is correct
2 Execution timed out 3056 ms 332 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2338 ms 204 KB Output is correct
2 Execution timed out 3065 ms 332 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3045 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3068 ms 704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3056 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 752 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3064 ms 1060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 1056 KB Time limit exceeded
2 Halted 0 ms 0 KB -