# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580437 | juggernaut | Lottery (CEOI18_lot) | C++14 | 570 ms | 32372 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
#define printl(args...) printf(args)
#else
#define printl(args...) 0
#endif
int n,l;
int a[10005];
int b[2005][2005];
int main(){
scanf("%d%d",&n,&l);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i+l-1<=n;i++){
for(int j=1;j+l-1<=n;j++){
int cnt=0;
for(int k=0;k<l;k++)if(a[i+k]!=a[j+k])cnt++;
b[i][cnt]++;
}
for(int j=1;j<2005;j++)b[i][j]+=b[i][j-1];
}
int q;
scanf("%d",&q);
while(q--){
int x;
scanf("%d",&x);
for(int i=1;i+l-1<=n;i++)printf("%d ",b[i][x]-1);
puts("");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |