CSES - Datatähti 2019 alku - Results
Submission details
Task:Taulukko
Sender:SMemsky
Submission time:2018-10-02 17:18:20 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:5:5: error: two or more data types in declaration of 'type name'
 int main() {
     ^~~~

Code

#include <bits/stdc++.h>

using u64 = uint64_t

int main() {
    u64 n = 0, k = 0;
    std::cin >> n >> k;

    std::vector<u64> vals(n);
    for (u64 i = 0; i < n; ++i) {
        std::cin >> vals[i];
    }

    u64 ctr = 0;

    for (u64 l = 1; i <= l; ++l) {
        for (u64 i = 0; i < (n - l + 1); ++i) {
            // slice [i:i+l]
            bool ok = true;
            std::set<u64> foos;
            for (u64 a = i; a < i + l; ++a) {
                foos.insert(a);
                if (foos.size() > k) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                ++ctr;
            }
        }
    }

    std::cout << ctr << std::endl;
}