Submission #967696

# Submission time Handle Problem Language Result Execution time Memory
967696 2024-04-22T16:11:18 Z Charizard2021 Lottery (CEOI18_lot) C++17
45 / 100
426 ms 49500 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, l;
    cin >> n >> l;
    int a[1 + n];
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    vector<vector<short> > A(n - l + 2, vector<short>(1 + l, 0));
    for(int j = 1; j <= n - l; j++){
        int curDiff =0 ;
        for(int i = 0; i < l; i++){
            if(a[1 + i] != a[j + 1 + i]){
                curDiff++;
            }
        }
        A[1][curDiff]++;
        A[j + 1][curDiff]++;
        for(int cur = 2; cur + j <= n - l + 1; cur++){
            if(a[cur - 1] != a[cur - 1 + j]){
                curDiff--;
            }
            if(a[cur + l - 1] != a[cur + l - 1 + j]){
                curDiff++;
            }
            A[cur][curDiff]++;
            A[j + cur][curDiff]++;
        }
    }
    for(int i = 1; i <= n - l + 1; i++){
        for(int j = 1; j <= l; j++){
            A[i][j] += A[i][j - 1];
        }
    }
    int q;
    cin >> q;
    while(q--){
        int k;
        cin >> k;
        for(int i = 1; i <= n - l + 1; i++){
            cout << A[i][k] << " ";
        }
        cout << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 6 ms 348 KB Output is correct
14 Correct 8 ms 2244 KB Output is correct
15 Correct 9 ms 2140 KB Output is correct
16 Correct 8 ms 1368 KB Output is correct
17 Correct 8 ms 1628 KB Output is correct
18 Correct 8 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 299 ms 1024 KB Output is correct
2 Correct 426 ms 856 KB Output is correct
3 Correct 140 ms 860 KB Output is correct
4 Correct 160 ms 4700 KB Output is correct
5 Runtime error 262 ms 49500 KB Memory limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 299 ms 1024 KB Output is correct
2 Correct 426 ms 856 KB Output is correct
3 Correct 140 ms 860 KB Output is correct
4 Correct 160 ms 4700 KB Output is correct
5 Runtime error 262 ms 49500 KB Memory limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 6 ms 348 KB Output is correct
14 Correct 8 ms 2244 KB Output is correct
15 Correct 9 ms 2140 KB Output is correct
16 Correct 8 ms 1368 KB Output is correct
17 Correct 8 ms 1628 KB Output is correct
18 Correct 8 ms 1628 KB Output is correct
19 Correct 299 ms 1024 KB Output is correct
20 Correct 426 ms 856 KB Output is correct
21 Correct 140 ms 860 KB Output is correct
22 Correct 160 ms 4700 KB Output is correct
23 Runtime error 262 ms 49500 KB Memory limit exceeded
24 Halted 0 ms 0 KB -