답안 #941287

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941287 2024-03-08T12:40:02 Z sleepntsheep Lottery (CEOI18_lot) C
45 / 100
45 ms 65536 KB
#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("");
    }
}

Compilation message

lot.c: In function 'main':
lot.c:15:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d%d",&n,&l);
      |     ^~~~~~~~~~~~~~~~~~~
lot.c:16:26: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     for(int i=1;i<=n;++i)scanf("%d",a+i);
      |                          ^~~~~~~~~~~~~~~
lot.c:20:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d",&q);
      |     ^~~~~~~~~~~~~~
lot.c:21:26: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     for(int i=0;i<q;++i) scanf("%d",c+i);
      |                          ^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 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 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 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 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 2 ms 2396 KB Output is correct
13 Correct 33 ms 7736 KB Output is correct
14 Correct 28 ms 7768 KB Output is correct
15 Correct 19 ms 7772 KB Output is correct
16 Correct 45 ms 7760 KB Output is correct
17 Correct 37 ms 7764 KB Output is correct
18 Correct 38 ms 7744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 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 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 2 ms 2396 KB Output is correct
13 Correct 33 ms 7736 KB Output is correct
14 Correct 28 ms 7768 KB Output is correct
15 Correct 19 ms 7772 KB Output is correct
16 Correct 45 ms 7760 KB Output is correct
17 Correct 37 ms 7764 KB Output is correct
18 Correct 38 ms 7744 KB Output is correct
19 Runtime error 28 ms 65536 KB Execution killed with signal 9
20 Halted 0 ms 0 KB -