# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1059871 |
2024-08-15T08:47:59 Z |
Piokemon |
Lottery (CEOI18_lot) |
C++17 |
|
408 ms |
16732 KB |
#include <iostream>
#include <map>
using namespace std;
typedef long long int ll;
constexpr int N = 2000;
constexpr int N2 = 1e4;
short int odp[N+9][N+9];
int a[N2+9];
pair<ll,ll> mod = {2e9+323,2e9+11};
pair<ll,ll> byl[N2+9];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,l,q,pyt;
cin >> n >> l;
for (int x=1;x<=n;x++) cin >> a[x];
cin >> q;
cin >> pyt;
if (q==1 && pyt==0){
pair<ll,ll> maks={1,1};
pair<ll,ll> ter={0,0};
ll p=1e9+1;
map<pair<ll,ll>,int> cnt;
for (int x=1;x<l;x++)maks={(maks.first*p)%mod.first,(maks.second*p)%mod.second};
for (int x=1;x<=l;x++)ter={((ter.first*p)+a[x])%mod.first,((ter.second*p)+a[x])%mod.second};
cnt[ter]++;
byl[1]=ter;
for (int x=2;x<=n-l+1;x++){
ter.first = (ter.first-maks.first*a[x-1]+mod.first*mod.first)%mod.first;
ter.second = (ter.second-maks.second*a[x-1]+mod.second*mod.second)%mod.second;
ter={((ter.first*p)+a[x+l-1])%mod.first,((ter.second*p)+a[x+l-1])%mod.second};
cnt[ter]++;
byl[x]=ter;
}
for (int x=1;x<=n-l+1;x++) cout << cnt[byl[x]]-1 << ' ';
cout << '\n';
return 0;
}
int dist;
for (int x=1;x<=n-l;x++){
for (int y=x+1;y<=n-l+1;y++){
dist=0;
for (int z=0;z<l;z++)dist+=a[x+z]!=a[y+z];
odp[x][dist]++;
odp[y][dist]++;
}
}
for (int x=1;x<=n;x++){
for (int k=1;k<=n;k++)odp[x][k]=odp[x][k]+odp[x][k-1];
}
while(q--){
for (int x=1;x<=n-l+1;x++) cout << odp[x][pyt] << ' ';
cout << '\n';
cin >> pyt;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
2 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
2 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
2 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
2 ms |
2396 KB |
Output is correct |
13 |
Correct |
18 ms |
8280 KB |
Output is correct |
14 |
Correct |
403 ms |
8400 KB |
Output is correct |
15 |
Correct |
408 ms |
8144 KB |
Output is correct |
16 |
Correct |
250 ms |
8276 KB |
Output is correct |
17 |
Correct |
328 ms |
8320 KB |
Output is correct |
18 |
Correct |
321 ms |
8272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
2 ms |
2652 KB |
Output is correct |
3 |
Correct |
3 ms |
2652 KB |
Output is correct |
4 |
Correct |
3 ms |
2880 KB |
Output is correct |
5 |
Correct |
3 ms |
2908 KB |
Output is correct |
6 |
Correct |
5 ms |
3164 KB |
Output is correct |
7 |
Correct |
1 ms |
2636 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
2 ms |
2652 KB |
Output is correct |
10 |
Correct |
2 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
2868 KB |
Output is correct |
13 |
Correct |
3 ms |
2916 KB |
Output is correct |
14 |
Correct |
3 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
2 ms |
2652 KB |
Output is correct |
3 |
Correct |
3 ms |
2652 KB |
Output is correct |
4 |
Correct |
3 ms |
2880 KB |
Output is correct |
5 |
Correct |
3 ms |
2908 KB |
Output is correct |
6 |
Correct |
5 ms |
3164 KB |
Output is correct |
7 |
Correct |
1 ms |
2636 KB |
Output is correct |
8 |
Correct |
2 ms |
2652 KB |
Output is correct |
9 |
Correct |
2 ms |
2652 KB |
Output is correct |
10 |
Correct |
2 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
3 ms |
2868 KB |
Output is correct |
13 |
Correct |
3 ms |
2916 KB |
Output is correct |
14 |
Correct |
3 ms |
2908 KB |
Output is correct |
15 |
Runtime error |
8 ms |
16732 KB |
Execution killed with signal 11 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
2 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
2 ms |
2396 KB |
Output is correct |
13 |
Correct |
18 ms |
8280 KB |
Output is correct |
14 |
Correct |
403 ms |
8400 KB |
Output is correct |
15 |
Correct |
408 ms |
8144 KB |
Output is correct |
16 |
Correct |
250 ms |
8276 KB |
Output is correct |
17 |
Correct |
328 ms |
8320 KB |
Output is correct |
18 |
Correct |
321 ms |
8272 KB |
Output is correct |
19 |
Correct |
2 ms |
2652 KB |
Output is correct |
20 |
Correct |
2 ms |
2652 KB |
Output is correct |
21 |
Correct |
3 ms |
2652 KB |
Output is correct |
22 |
Correct |
3 ms |
2880 KB |
Output is correct |
23 |
Correct |
3 ms |
2908 KB |
Output is correct |
24 |
Correct |
5 ms |
3164 KB |
Output is correct |
25 |
Correct |
1 ms |
2636 KB |
Output is correct |
26 |
Correct |
2 ms |
2652 KB |
Output is correct |
27 |
Correct |
2 ms |
2652 KB |
Output is correct |
28 |
Correct |
2 ms |
2652 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
3 ms |
2868 KB |
Output is correct |
31 |
Correct |
3 ms |
2916 KB |
Output is correct |
32 |
Correct |
3 ms |
2908 KB |
Output is correct |
33 |
Runtime error |
8 ms |
16732 KB |
Execution killed with signal 11 |
34 |
Halted |
0 ms |
0 KB |
- |