Submission #147234

# Submission time Handle Problem Language Result Execution time Memory
147234 2019-08-28T13:00:46 Z miguel Lottery (CEOI18_lot) C++14
45 / 100
2264 ms 42248 KB
/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = 998244353;
const ll nmax=1000003;
#define int ll
int n, l, a[10010], dif[10010], ans[10010][10010], q;//idx, k

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n>>l;
    for(int i=1; i<=n; i++) cin>>a[i];
    for(int d=1; d<=n-l; d++){
		memset(dif, 0, sizeof dif);
		for(int i=1; i<=n-d; i++){
			if(a[i]!=a[i+d]) dif[i]++, dif[min(i+l, n+1)]--;
		}
		for(int i=1; i<=n-d; i++){
			dif[i]+=dif[i-1];
			//if(d==1) cout<<i-l+1<<" "<<dif[i]<<endl;
			if(i>=l) ans[i-l+1][dif[i]]++, ans[i-l+1+d][dif[i]]++;
		}
	}
	for(int i=1; i<=n-l+1; i++){
		for(int k=1; k<=l; k++)  ans[i][k]+=ans[i][k-1];
	}
	cin>>q;
	while(q--){
		int id;
		cin>>id;
		for(int i=1; i<=n-l+1; i++) cout<<ans[i][id]<<" ";
		cout<<"\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
6 Correct 3 ms 888 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 4 ms 1272 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 5 ms 1656 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
6 Correct 3 ms 888 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 4 ms 1272 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 5 ms 1656 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1656 KB Output is correct
13 Correct 49 ms 8824 KB Output is correct
14 Correct 38 ms 13048 KB Output is correct
15 Correct 33 ms 13008 KB Output is correct
16 Correct 48 ms 11000 KB Output is correct
17 Correct 42 ms 11768 KB Output is correct
18 Correct 40 ms 11768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2264 ms 42248 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2264 ms 42248 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 760 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
6 Correct 3 ms 888 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 4 ms 1272 KB Output is correct
9 Correct 4 ms 1272 KB Output is correct
10 Correct 5 ms 1656 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1656 KB Output is correct
13 Correct 49 ms 8824 KB Output is correct
14 Correct 38 ms 13048 KB Output is correct
15 Correct 33 ms 13008 KB Output is correct
16 Correct 48 ms 11000 KB Output is correct
17 Correct 42 ms 11768 KB Output is correct
18 Correct 40 ms 11768 KB Output is correct
19 Runtime error 2264 ms 42248 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
20 Halted 0 ms 0 KB -