Submission #1028871

# Submission time Handle Problem Language Result Execution time Memory
1028871 2024-07-20T09:43:48 Z dimasnbayu Lottery (CEOI18_lot) C++14
0 / 100
355 ms 48988 KB
#include<bits/stdc++.h>
using namespace std;
#define int short
const int MAX_N=10000+5;
int arr[MAX_N],much[MAX_N][MAX_N];
signed main(){
    int n,l; cin>>n>>l;
    for(int i=1;i<=n;i++) cin>>arr[i];
    for(int i=1;i<=n-l+1;i++){
        for(int j=i+1;j<=n-l+1;j++){
            int cnt=0;
            for(int k=0;k<l;k++){
                if(arr[i+k]!=arr[j+k]) cnt++;
            }
            much[i][cnt]++;
            much[j][cnt]++;
        }
    }
    for(int i=1;i<=n-l+1;i++){
        for(int j=0;j<=l;j++){
            // cout<<much[i][j]<<" ";
            much[i][j]+=much[i][j-1];
        }
        // cout<<endl;
    }
    int q; cin>>q;
    while(q--){
        int x; cin>>x;
        for(int i=1;i<=n-l+1;i++) cout<<much[i][x]<<" ";
        cout<<endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2488 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2488 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 355 ms 48988 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 355 ms 48988 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2488 KB Output is correct
5 Incorrect 1 ms 2396 KB Output isn't correct
6 Halted 0 ms 0 KB -