Submission #1108403

# Submission time Handle Problem Language Result Execution time Memory
1108403 2024-11-04T04:21:55 Z koukirocks Lottery (CEOI18_lot) C++17
0 / 100
49 ms 65536 KB
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("popcnt")
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MAX=2e5+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
const ldb eps=1e-6;
const ldb PI=acos(-1.0);
const int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
template<typename T>
using vvector = vector<vector<T>>;

vvector<int> mm(10000,vector<int>(10000));
vvector<int> mmm(10000,vector<int>(10000+1));
int main() {
    speed;
    int n,l;
    cin>>n>>l;
    vector<int> a(n+1);
    for (int i=0;i<n;i++) {
        cin>>a[i];
    }
    for (int g=1;g+l<=n;g++) {
        int now=0;
        for (int i=0;i<l;i++) {
            if (a[i]!=a[i+g]) now++;
        }
        for (int i=0;i+g+l<=n;i++) {
            mm[i][i+g]=now;
            now-=(a[i]!=a[i+g]);
            now+=(a[i+l]!=a[i+g+l]);
        }
    }
    for (int i=0;i<=n-l;i++) {
        for (int j=i+1;j<=n-l;j++) {
            mmm[i][mm[i][j]]++;
            mmm[j][mm[i][j]]++;
        }
        for (int j=1;j<=l;j++) mmm[i][j]+=mmm[i][j-1];
    }
    int q;
    cin>>q;
    while (q--) {
        int k;
        cin>>k;
        for (int i=0;i+l<=n;i++) cout<<mmm[i][k]<<" ";
        cout<<"\n";
    }
    return 0;
}

/*
10 10
2 34 545 56 3 3 65 2 7 6
*/
# Verdict Execution time Memory Grader output
1 Runtime error 47 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 47 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 49 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 49 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 47 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -