Submission #362197

# Submission time Handle Problem Language Result Execution time Memory
362197 2021-02-02T03:06:59 Z sumit_kk10 Lottery (CEOI18_lot) C++14
45 / 100
690 ms 33004 KB
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
using namespace std;
const int MOD = 1e9 + 7;
const int N = 2000 + 5;
int ok[N][N];

void solve() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    for(int i = 0; i <= n - k; ++i) {
        for (int j = 0; j <= n - k; ++j) {
            if (i == j)
                continue;
            int diff = 0;
            for (int e = 0; e < k; ++e)
                if (a[i + e] != a[j + e])
                    ++diff;
            ok[i][j] = diff;
        }
    }
    int q;
    cin >> q;
    while(q--){
        int dis;
        cin >> dis;
        for(int i = 0; i <= n - k; ++i) {
            int ans = 0;
            for (int j = 0; j <= n - k; ++j) {
                if (i == j) continue;
                ans += (ok[i][j] <= dis);
            }
            cout << ans << " ";
        }
        cout << "\n";
    }
}

int main() {
    fast;
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 748 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 748 KB Output is correct
7 Correct 1 ms 748 KB Output is correct
8 Correct 5 ms 1004 KB Output is correct
9 Correct 4 ms 1004 KB Output is correct
10 Correct 5 ms 1792 KB Output is correct
11 Correct 6 ms 1772 KB Output is correct
12 Correct 5 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 748 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 748 KB Output is correct
7 Correct 1 ms 748 KB Output is correct
8 Correct 5 ms 1004 KB Output is correct
9 Correct 4 ms 1004 KB Output is correct
10 Correct 5 ms 1792 KB Output is correct
11 Correct 6 ms 1772 KB Output is correct
12 Correct 5 ms 1644 KB Output is correct
13 Correct 64 ms 16108 KB Output is correct
14 Correct 676 ms 10860 KB Output is correct
15 Correct 690 ms 10920 KB Output is correct
16 Correct 509 ms 14564 KB Output is correct
17 Correct 570 ms 13512 KB Output is correct
18 Correct 590 ms 13548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 206 ms 33004 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 206 ms 33004 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 620 KB Output is correct
3 Correct 1 ms 748 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 748 KB Output is correct
7 Correct 1 ms 748 KB Output is correct
8 Correct 5 ms 1004 KB Output is correct
9 Correct 4 ms 1004 KB Output is correct
10 Correct 5 ms 1792 KB Output is correct
11 Correct 6 ms 1772 KB Output is correct
12 Correct 5 ms 1644 KB Output is correct
13 Correct 64 ms 16108 KB Output is correct
14 Correct 676 ms 10860 KB Output is correct
15 Correct 690 ms 10920 KB Output is correct
16 Correct 509 ms 14564 KB Output is correct
17 Correct 570 ms 13512 KB Output is correct
18 Correct 590 ms 13548 KB Output is correct
19 Runtime error 206 ms 33004 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -