Submission #1024122

# Submission time Handle Problem Language Result Execution time Memory
1024122 2024-07-15T12:35:17 Z NValchanov Lottery (CEOI18_lot) C++17
45 / 100
497 ms 41304 KB
#include <bits/stdc++.h>

#define endl '\n'

using namespace std;

typedef long long ll;

const int MAXN = 1e4 + 10;

int n, k, q;
int a[MAXN];
int cnt[MAXN][MAXN];

void read()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
}

void solve()
{
    for(int i = 1; i <= n - k + 1; i++)
    {
        for(int j = i + 1; j <= n - k + 1; j++)
        {
            int matches = 0;
            for(int idx = 1; idx <= k; idx++)
            {
                if(a[i + idx - 1] != a[j + idx - 1])
                    matches++;
            }
            
            for(int idx = matches; idx <= k; idx++)
            {
                cnt[i][idx]++;
                cnt[j][idx]++;
            }
        }
    }
}

void process_queries()
{
    cin >> q;
    for(int i = 1; i <= q; i++)
    {
        int c;
        cin >> c;

        for(int j = 1; j <= n - k + 1; j++)
        {
            cout << cnt[j][c] << " ";
        }
        cout << endl;
    }
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    read();
    solve();
    process_queries();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 2 ms 1096 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 2 ms 1628 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 2 ms 1096 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 2 ms 1628 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 17 ms 8540 KB Output is correct
14 Correct 247 ms 5932 KB Output is correct
15 Correct 275 ms 9040 KB Output is correct
16 Correct 173 ms 9168 KB Output is correct
17 Correct 189 ms 8784 KB Output is correct
18 Correct 193 ms 9296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 497 ms 41304 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 497 ms 41304 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 2 ms 1096 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 2 ms 1628 KB Output is correct
11 Correct 2 ms 1492 KB Output is correct
12 Correct 2 ms 1372 KB Output is correct
13 Correct 17 ms 8540 KB Output is correct
14 Correct 247 ms 5932 KB Output is correct
15 Correct 275 ms 9040 KB Output is correct
16 Correct 173 ms 9168 KB Output is correct
17 Correct 189 ms 8784 KB Output is correct
18 Correct 193 ms 9296 KB Output is correct
19 Runtime error 497 ms 41304 KB Memory limit exceeded
20 Halted 0 ms 0 KB -