# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941283 | 2024-03-08T12:35:03 Z | sleepntsheep | Lottery (CEOI18_lot) | C | 31 ms | 65536 KB |
#include<stdio.h> #define N 10001 int n,l,q,a[N]; short ans[N][N]; short dp[N*(N+1)/2]; int pos(int x,int y) { return (y+1ll)*(y+2)/2+x; } int main() { scanf("%d%d",&n,&l); for(int i=1;i<=n;++i)scanf("%d",a+i); for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j)dp[pos(i,j)]=(a[i]!=a[j]); for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j)dp[pos(i,j)]+=dp[pos(i-1,j-1)]; for(int i=1;i+l-1<=n;++i)for(int j=i+1;j+l-1<=n;++j) { int d=dp[pos(i+l-1,j+l-1)]-dp[pos(i-1,j-1)]; ans[i][d]++; ans[j][d]++; } for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)ans[i][j]+=ans[i][j-1]; scanf("%d",&q); for(int u;q--;) { scanf("%d",&u); for(int i=1;i+l-1<=n;++i)printf("%d ",ans[i][u]); puts(""); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 4956 KB | Output is correct |
9 | Correct | 1 ms | 4956 KB | Output is correct |
10 | Correct | 2 ms | 6692 KB | Output is correct |
11 | Correct | 2 ms | 6492 KB | Output is correct |
12 | Correct | 2 ms | 6488 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 4956 KB | Output is correct |
9 | Correct | 1 ms | 4956 KB | Output is correct |
10 | Correct | 2 ms | 6692 KB | Output is correct |
11 | Correct | 2 ms | 6492 KB | Output is correct |
12 | Correct | 2 ms | 6488 KB | Output is correct |
13 | Runtime error | 31 ms | 46684 KB | Memory limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 4444 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 4956 KB | Output is correct |
9 | Correct | 1 ms | 4956 KB | Output is correct |
10 | Correct | 2 ms | 6692 KB | Output is correct |
11 | Correct | 2 ms | 6492 KB | Output is correct |
12 | Correct | 2 ms | 6488 KB | Output is correct |
13 | Runtime error | 31 ms | 46684 KB | Memory limit exceeded |
14 | Halted | 0 ms | 0 KB | - |