답안 #941282

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941282 2024-03-08T12:33:00 Z sleepntsheep Lottery (CEOI18_lot) C
25 / 100
38 ms 65536 KB
#include<stdio.h>

#define N 10001
int n,l,q,a[N];
short ans[N][N];
short dp[N][N];

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[i][j]=(a[i]!=a[j]);
    for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j)dp[i][j]+=dp[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[i+l-1][j+l-1]-dp[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

lot.c: In function 'main':
lot.c:10:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d%d",&n,&l);
      |     ^~~~~~~~~~~~~~~~~~~
lot.c:11:26: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for(int i=1;i<=n;++i)scanf("%d",a+i);
      |                          ^~~~~~~~~~~~~~~
lot.c:22:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%d",&q);
      |     ^~~~~~~~~~~~~~
lot.c:25:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("%d",&u);
      |         ^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 6748 KB Output is correct
3 Correct 1 ms 6824 KB Output is correct
4 Correct 1 ms 6748 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 3 ms 13148 KB Output is correct
9 Correct 2 ms 13148 KB Output is correct
10 Correct 3 ms 14940 KB Output is correct
11 Correct 3 ms 14940 KB Output is correct
12 Correct 3 ms 15036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 6748 KB Output is correct
3 Correct 1 ms 6824 KB Output is correct
4 Correct 1 ms 6748 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 3 ms 13148 KB Output is correct
9 Correct 2 ms 13148 KB Output is correct
10 Correct 3 ms 14940 KB Output is correct
11 Correct 3 ms 14940 KB Output is correct
12 Correct 3 ms 15036 KB Output is correct
13 Runtime error 38 ms 65536 KB Execution killed with signal 9
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 35 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 35 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 6748 KB Output is correct
3 Correct 1 ms 6824 KB Output is correct
4 Correct 1 ms 6748 KB Output is correct
5 Correct 1 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 3 ms 13148 KB Output is correct
9 Correct 2 ms 13148 KB Output is correct
10 Correct 3 ms 14940 KB Output is correct
11 Correct 3 ms 14940 KB Output is correct
12 Correct 3 ms 15036 KB Output is correct
13 Runtime error 38 ms 65536 KB Execution killed with signal 9
14 Halted 0 ms 0 KB -