# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
383624 |
2021-03-30T12:12:55 Z |
rumen_m |
Lottery (CEOI18_lot) |
C++17 |
|
3000 ms |
4460 KB |
# include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4+5;
int a[maxn];
int calc(int x, int y, int l)
{
int sum = 0;
int i;
for(i=0;i<l;i++)
{
if(a[x+i]!=a[y+i])sum++;
}
return sum;
}
struct queries
{
int idx;
int p[maxn];
int k;
};
queries q[105];
bool cmp(queries i, queries j)
{
return i.k>j.k;
}int Q;
void add(int x, int v)
{
int i;
for(i=1;i<=Q;i++)
{
if(q[i].k<v)return ;
q[i].p[x]++;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,l;
cin>>n>>l;
int i,j;
for(i=1;i<=n;i++)cin>>a[i];
cin>>Q;
for(i=1;i<=Q;i++){q[i].idx=i;cin>>q[i].k;}
sort(q+1,q+Q+1,cmp);
for(i=2;i<=n-l+1;i++)
{
int num = calc(1,i,l);
add(1,num);
add(i,num);
int f = 1;
int s = i;
// cout<<f<<" - "<<s<<" : "<<num<<endl;
for(j=i+1;j<=n-l+1;j++)
{
if(a[f]!=a[s])num--;
f++;
s++;
if(a[f+l-1]!=a[s+l-1])num++;
add(f,num);
add(s,num);
// cout<<f<<" - "<<s<<" : "<<num<<endl;
}
}
for(i=1;i<=Q;i++)
{
j = 1;
while(q[j].idx!=i)j++;
for(int t=1;t<=n-l+1;t++)
cout<<q[j].p[t]<<" ";
cout<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
1260 KB |
Output is correct |
3 |
Correct |
3 ms |
1260 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
1 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
876 KB |
Output is correct |
7 |
Correct |
2 ms |
876 KB |
Output is correct |
8 |
Correct |
3 ms |
1260 KB |
Output is correct |
9 |
Correct |
3 ms |
1260 KB |
Output is correct |
10 |
Correct |
3 ms |
1260 KB |
Output is correct |
11 |
Correct |
3 ms |
1260 KB |
Output is correct |
12 |
Correct |
3 ms |
1260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
1260 KB |
Output is correct |
3 |
Correct |
3 ms |
1260 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
1 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
876 KB |
Output is correct |
7 |
Correct |
2 ms |
876 KB |
Output is correct |
8 |
Correct |
3 ms |
1260 KB |
Output is correct |
9 |
Correct |
3 ms |
1260 KB |
Output is correct |
10 |
Correct |
3 ms |
1260 KB |
Output is correct |
11 |
Correct |
3 ms |
1260 KB |
Output is correct |
12 |
Correct |
3 ms |
1260 KB |
Output is correct |
13 |
Correct |
18 ms |
748 KB |
Output is correct |
14 |
Correct |
10 ms |
1388 KB |
Output is correct |
15 |
Correct |
7 ms |
1004 KB |
Output is correct |
16 |
Correct |
11 ms |
1388 KB |
Output is correct |
17 |
Correct |
9 ms |
1388 KB |
Output is correct |
18 |
Correct |
9 ms |
1388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
405 ms |
492 KB |
Output is correct |
2 |
Correct |
506 ms |
504 KB |
Output is correct |
3 |
Correct |
183 ms |
492 KB |
Output is correct |
4 |
Correct |
141 ms |
748 KB |
Output is correct |
5 |
Correct |
54 ms |
492 KB |
Output is correct |
6 |
Correct |
125 ms |
620 KB |
Output is correct |
7 |
Correct |
94 ms |
620 KB |
Output is correct |
8 |
Correct |
204 ms |
620 KB |
Output is correct |
9 |
Correct |
120 ms |
620 KB |
Output is correct |
10 |
Correct |
115 ms |
620 KB |
Output is correct |
11 |
Correct |
14 ms |
364 KB |
Output is correct |
12 |
Correct |
88 ms |
492 KB |
Output is correct |
13 |
Correct |
76 ms |
492 KB |
Output is correct |
14 |
Correct |
82 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
405 ms |
492 KB |
Output is correct |
2 |
Correct |
506 ms |
504 KB |
Output is correct |
3 |
Correct |
183 ms |
492 KB |
Output is correct |
4 |
Correct |
141 ms |
748 KB |
Output is correct |
5 |
Correct |
54 ms |
492 KB |
Output is correct |
6 |
Correct |
125 ms |
620 KB |
Output is correct |
7 |
Correct |
94 ms |
620 KB |
Output is correct |
8 |
Correct |
204 ms |
620 KB |
Output is correct |
9 |
Correct |
120 ms |
620 KB |
Output is correct |
10 |
Correct |
115 ms |
620 KB |
Output is correct |
11 |
Correct |
14 ms |
364 KB |
Output is correct |
12 |
Correct |
88 ms |
492 KB |
Output is correct |
13 |
Correct |
76 ms |
492 KB |
Output is correct |
14 |
Correct |
82 ms |
492 KB |
Output is correct |
15 |
Correct |
268 ms |
620 KB |
Output is correct |
16 |
Correct |
103 ms |
620 KB |
Output is correct |
17 |
Correct |
147 ms |
620 KB |
Output is correct |
18 |
Correct |
117 ms |
620 KB |
Output is correct |
19 |
Correct |
111 ms |
620 KB |
Output is correct |
20 |
Correct |
107 ms |
748 KB |
Output is correct |
21 |
Correct |
106 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
1260 KB |
Output is correct |
3 |
Correct |
3 ms |
1260 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
1 ms |
620 KB |
Output is correct |
6 |
Correct |
2 ms |
876 KB |
Output is correct |
7 |
Correct |
2 ms |
876 KB |
Output is correct |
8 |
Correct |
3 ms |
1260 KB |
Output is correct |
9 |
Correct |
3 ms |
1260 KB |
Output is correct |
10 |
Correct |
3 ms |
1260 KB |
Output is correct |
11 |
Correct |
3 ms |
1260 KB |
Output is correct |
12 |
Correct |
3 ms |
1260 KB |
Output is correct |
13 |
Correct |
18 ms |
748 KB |
Output is correct |
14 |
Correct |
10 ms |
1388 KB |
Output is correct |
15 |
Correct |
7 ms |
1004 KB |
Output is correct |
16 |
Correct |
11 ms |
1388 KB |
Output is correct |
17 |
Correct |
9 ms |
1388 KB |
Output is correct |
18 |
Correct |
9 ms |
1388 KB |
Output is correct |
19 |
Correct |
405 ms |
492 KB |
Output is correct |
20 |
Correct |
506 ms |
504 KB |
Output is correct |
21 |
Correct |
183 ms |
492 KB |
Output is correct |
22 |
Correct |
141 ms |
748 KB |
Output is correct |
23 |
Correct |
54 ms |
492 KB |
Output is correct |
24 |
Correct |
125 ms |
620 KB |
Output is correct |
25 |
Correct |
94 ms |
620 KB |
Output is correct |
26 |
Correct |
204 ms |
620 KB |
Output is correct |
27 |
Correct |
120 ms |
620 KB |
Output is correct |
28 |
Correct |
115 ms |
620 KB |
Output is correct |
29 |
Correct |
14 ms |
364 KB |
Output is correct |
30 |
Correct |
88 ms |
492 KB |
Output is correct |
31 |
Correct |
76 ms |
492 KB |
Output is correct |
32 |
Correct |
82 ms |
492 KB |
Output is correct |
33 |
Correct |
268 ms |
620 KB |
Output is correct |
34 |
Correct |
103 ms |
620 KB |
Output is correct |
35 |
Correct |
147 ms |
620 KB |
Output is correct |
36 |
Correct |
117 ms |
620 KB |
Output is correct |
37 |
Correct |
111 ms |
620 KB |
Output is correct |
38 |
Correct |
107 ms |
748 KB |
Output is correct |
39 |
Correct |
106 ms |
620 KB |
Output is correct |
40 |
Correct |
1599 ms |
2284 KB |
Output is correct |
41 |
Correct |
14 ms |
1516 KB |
Output is correct |
42 |
Correct |
254 ms |
2284 KB |
Output is correct |
43 |
Correct |
128 ms |
1900 KB |
Output is correct |
44 |
Correct |
119 ms |
1900 KB |
Output is correct |
45 |
Execution timed out |
3092 ms |
4460 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |