Submission #1060190

# Submission time Handle Problem Language Result Execution time Memory
1060190 2024-08-15T11:24:29 Z kachim2 Lottery (CEOI18_lot) C++17
45 / 100
3000 ms 860 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int l, n;
    cin >> n >> l;
    vector<int> a(n);
    vector<__int128_t> hashe(n-l+1);
    for(auto &i:a) cin >> i;
    __int128_t almoptrime = 1;
    almoptrime<<=126;
    almoptrime-=1;
    for(int i = 0; i < n-l+1; i++)
    {
        __int128_t has = 0;
        for(int llll = 0; llll < l; llll++)
        {
            has*=7935;
            has+=a[i+llll];
            has%=almoptrime;

        }
        hashe[i]=has;
    }
    int q;
    cin >> q;
    while(q--)
    {
        int k;
        cin >> k;
        if(k==0){
        for(int i = 0; i < n-l+1; i++)
        {
            int ans = 0;
            for(int j = 0; j < n-l+1; j++)
            {
                if (i==j) continue;
                if(hashe[i]==hashe[j]) ans++;
            }
            cout << ans << ' ';
        }
        cout << '\n';
        }
        else{
                    for(int i = 0; i < n-l+1; i++)
        {
            int ans = 0;
            for(int j = 0; j < n-l+1; j++)
            {
                if (i==j) continue;
                int diff = 0;
                for(int llll = 0; llll < l; llll++)
                {
                    diff+=a[i+llll]!=a[j+llll];
                }
                if(diff<=k) ans++;
            }
            cout << ans << ' ';
        }
        cout << '\n';
        }

    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 48 ms 440 KB Output is correct
9 Correct 47 ms 344 KB Output is correct
10 Correct 19 ms 348 KB Output is correct
11 Correct 16 ms 444 KB Output is correct
12 Correct 31 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 48 ms 440 KB Output is correct
9 Correct 47 ms 344 KB Output is correct
10 Correct 19 ms 348 KB Output is correct
11 Correct 16 ms 444 KB Output is correct
12 Correct 31 ms 348 KB Output is correct
13 Correct 47 ms 472 KB Output is correct
14 Execution timed out 3013 ms 436 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 89 ms 604 KB Output is correct
2 Correct 71 ms 600 KB Output is correct
3 Correct 72 ms 632 KB Output is correct
4 Correct 95 ms 604 KB Output is correct
5 Correct 355 ms 524 KB Output is correct
6 Correct 160 ms 860 KB Output is correct
7 Correct 169 ms 540 KB Output is correct
8 Correct 174 ms 596 KB Output is correct
9 Correct 87 ms 640 KB Output is correct
10 Correct 80 ms 636 KB Output is correct
11 Correct 36 ms 344 KB Output is correct
12 Correct 234 ms 552 KB Output is correct
13 Correct 369 ms 348 KB Output is correct
14 Correct 368 ms 536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 604 KB Output is correct
2 Correct 71 ms 600 KB Output is correct
3 Correct 72 ms 632 KB Output is correct
4 Correct 95 ms 604 KB Output is correct
5 Correct 355 ms 524 KB Output is correct
6 Correct 160 ms 860 KB Output is correct
7 Correct 169 ms 540 KB Output is correct
8 Correct 174 ms 596 KB Output is correct
9 Correct 87 ms 640 KB Output is correct
10 Correct 80 ms 636 KB Output is correct
11 Correct 36 ms 344 KB Output is correct
12 Correct 234 ms 552 KB Output is correct
13 Correct 369 ms 348 KB Output is correct
14 Correct 368 ms 536 KB Output is correct
15 Execution timed out 3025 ms 612 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 48 ms 440 KB Output is correct
9 Correct 47 ms 344 KB Output is correct
10 Correct 19 ms 348 KB Output is correct
11 Correct 16 ms 444 KB Output is correct
12 Correct 31 ms 348 KB Output is correct
13 Correct 47 ms 472 KB Output is correct
14 Execution timed out 3013 ms 436 KB Time limit exceeded
15 Halted 0 ms 0 KB -