# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
941287 | sleepntsheep | Lottery (CEOI18_lot) | C11 | 45 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
#define N 10001
int n,l,q,a[N],c[101],cc,o[101];
short ans[100][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)];
scanf("%d",&q);
for(int i=0;i<q;++i) scanf("%d",c+i);
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)];
for(int k=0;k<q;++k)
{
if(c[k]>=d)
{
ans[k][i]++;
ans[k][j]++;
}
}
}
for(int u=0;u<q;++u)
{
for(int i=1;i+l-1<=n;++i)printf("%d ",ans[u][i]);
puts("");
}
}
컴파일 시 표준 에러 (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... |