Submission #804573

# Submission time Handle Problem Language Result Execution time Memory
804573 2023-08-03T09:53:43 Z Valaki2 Lottery (CEOI18_lot) C++14
45 / 100
18 ms 15960 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back

const int maxn = 2000; //!!!!!

int n, l, q;
int v[1 + maxn];
short dp[1 + maxn][1 + maxn];
short ans[1 + maxn][1 + maxn];

void solve() {
    cin >> n >> l;
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            dp[i][j] = dp[i - 1][j - 1];
            if(v[i] != v[j]) {
                dp[i][j]++;
            }
        }
    }
    for(int i = l; i <= n; i++) {
        for(int j = l; j <= n; j++) {
            short dist = dp[i][j] - dp[i - l][j - l];
            ans[i - l + 1][dist]++;
        }
    }
    for(int i = 1; i <= n - l + 1; i++) {
        ans[i][0]--;
        for(int j = 1; j <= l; j++) {
            ans[i][j] += ans[i][j - 1];
        }
    }
    cin >> q;
    for(int qi = 1; qi <= q; qi++) {
        short dist;
        cin >> dist;
        for(int i = 1; i <= n - l + 1; i++) {
            cout << ans[i][dist] << " ";
        }
        cout << "\n";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 968 KB Output is correct
8 Correct 1 ms 2004 KB Output is correct
9 Correct 1 ms 2124 KB Output is correct
10 Correct 2 ms 2516 KB Output is correct
11 Correct 2 ms 2628 KB Output is correct
12 Correct 2 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 968 KB Output is correct
8 Correct 1 ms 2004 KB Output is correct
9 Correct 1 ms 2124 KB Output is correct
10 Correct 2 ms 2516 KB Output is correct
11 Correct 2 ms 2628 KB Output is correct
12 Correct 2 ms 2516 KB Output is correct
13 Correct 16 ms 15960 KB Output is correct
14 Correct 14 ms 13396 KB Output is correct
15 Correct 14 ms 13392 KB Output is correct
16 Correct 17 ms 15204 KB Output is correct
17 Correct 17 ms 14772 KB Output is correct
18 Correct 18 ms 14768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 1024 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 968 KB Output is correct
8 Correct 1 ms 2004 KB Output is correct
9 Correct 1 ms 2124 KB Output is correct
10 Correct 2 ms 2516 KB Output is correct
11 Correct 2 ms 2628 KB Output is correct
12 Correct 2 ms 2516 KB Output is correct
13 Correct 16 ms 15960 KB Output is correct
14 Correct 14 ms 13396 KB Output is correct
15 Correct 14 ms 13392 KB Output is correct
16 Correct 17 ms 15204 KB Output is correct
17 Correct 17 ms 14772 KB Output is correct
18 Correct 18 ms 14768 KB Output is correct
19 Incorrect 1 ms 340 KB Output isn't correct
20 Halted 0 ms 0 KB -