CSES - Leirikisa 6.3.2017 - Results
Submission details
Task:Lista
Sender:JesseNiininen
Submission time:2017-03-06 15:07:39 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

Code

#include <bits/stdc++.h>
using namespace std;

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];

    int best = 100000;
    bitset<1000000000> used;
    for(int i = 0; i < n; i++){
        if(i > best)
            break;
        int num = v[i];
        if(used[num])
            continue;
        else
            used[num] = true;

        int score = i;
        for(int j = v.size() - 1; j >= 0; j--){
            if(v[j] == num){
                best = min(score, best);
                break;
            }

            if(score >= best)
                break;
            score++;
        }
    }

    cout << best;
}