CSES - Datatähti 2019 alku - Results
Submission details
Task:Taulukko
Sender:Narski
Submission time:2018-10-14 18:03:22 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:57:34: error: expected primary-expression before ')' token
             if(ak>0||lol == true))
                                  ^

Code

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    bool lol = false;
    long int n,k;
    cin >> n;
    cin >> k;
    long int t[n];
    vector<long int> a;
    long int ak = k;
    long int tulos = 0;
    for(int i = 0;i<n;i++)
    {
        cin >> t[i];
    }
    for(long int j = 0; j<n; j++)
    {
        for(long int x = j; x<n ;x++)
        {
            /*
            for(long int y = 0;y<a.size();y++)
            {
                if(a[y]==t[x])
                {
                    lol = true;
                    break;
                }
            }
            if((lol = true)||ak>0)
            {
                if(lol = false);
                {
                    a.push_back(t[x]);
                    ak--;
                }
                tulos++;
            }
            else
            {
                break;
            }
            */
            lol = (find(a.begin(), a.end(), t[x]) != a.end());
            if(x == (n-1))
            {
                if((ak>0||lol == true))
                {
                    tulos++;
                }
                break;
            }
            if(ak>0||lol == true))
            {
                tulos++;
                if((find(lol == false)
                {
                    a.push_back(t[x]);
                    ak--;
                }
            }
            else
            {
                break;
            }
        }
        a.clear();
        ak = k;
    }
    cout << tulos;

    return 0;
}