Submission #870828

# Submission time Handle Problem Language Result Execution time Memory
870828 2023-11-09T08:57:46 Z Darren0724 Lottery (CEOI18_lot) C++17
45 / 100
42 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define endl '\n'
const int N=100005;
const int INF=1e18;

int32_t main() {
    LCBorz;
    int n,k;cin>>n>>k;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    int ans[n+1][n+1]{};
    for(int i=1;i<n;i++){
        vector<int> a;
        //a.push_back(0);
        for(int j=0;j+i<n;j++){
            a.push_back(v[j]!=v[i+j]);
        }
        int sz=a.size();
        if(sz<k){
            continue;
        }
        int cnt=0;
        for(int j=0;j<k;j++){
            cnt+=a[j];
        }
        //cout<<0<<' '<<i<<' '<<cnt<<endl;
        ans[0][cnt]++;
        ans[i][cnt]++;
        for(int j=k;j<sz;j++){
            cnt-=a[j-k];
            cnt+=a[j];
            ans[j+1-k][cnt]++;
            ans[i+j+1-k][cnt]++;
            //cout<<j+1-k<<' '<<i+j+1-k<<' '<<cnt<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<=n;j++){
            ans[i][j]+=ans[i][j-1];
            //cout<<
        }
    }
    int q;cin>>q;
    for(int i=0;i<q;i++){
        int p;cin>>p;
        for(int j=0;j<n-k+1;j++){
            cout<<ans[j][p]<<' ';
        }
        cout<<endl;
    }
    

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 34 ms 32088 KB Output is correct
14 Correct 35 ms 31836 KB Output is correct
15 Correct 33 ms 31784 KB Output is correct
16 Correct 42 ms 32084 KB Output is correct
17 Correct 34 ms 31864 KB Output is correct
18 Correct 35 ms 31832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 34 ms 32088 KB Output is correct
14 Correct 35 ms 31836 KB Output is correct
15 Correct 33 ms 31784 KB Output is correct
16 Correct 42 ms 32084 KB Output is correct
17 Correct 34 ms 31864 KB Output is correct
18 Correct 35 ms 31832 KB Output is correct
19 Runtime error 35 ms 65536 KB Execution killed with signal 9
20 Halted 0 ms 0 KB -