답안 #986483

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
986483 2024-05-20T15:52:12 Z alexdd Binaria (CCO23_day1problem1) C++17
25 / 25
107 ms 13080 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e6+3;
int n,k;
int sum[1000005];
bool verif(int poz, int cur)
{
    if(cur<0 || cur>1) return 0;
    if(poz+k >= n) return 1;
    ///a[poz+k] - a[poz] = sum[poz+1] - sum[poz]
    return verif(poz+k, sum[poz+1] - sum[poz] + cur);
}
int put(int a, int exp)
{
    if(exp==0)
        return 1;
    if(exp%2==0)
        return put(a*a%MOD,exp/2);
    else
        return put(a*a%MOD,exp/2)*a%MOD;
}
int comb(int x, int y)
{
    if(x<y) return 0;
    int prod=1;
    for(int i=1;i<=x;i++)
        prod = prod*i%MOD;
    for(int i=1;i<=y;i++)
        prod = prod*put(i,MOD-2)%MOD;
    for(int i=1;i<=x-y;i++)
        prod = prod*put(i,MOD-2)%MOD;
    return prod;
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>k;
    for(int i=0;i<n-k+1;i++)
        cin>>sum[i];
    int cnt0=0,cnt1=0,cnt01=0;
    for(int i=0;i<k;i++)
    {
        bool pos0 = verif(i,0);
        bool pos1 = verif(i,1);
        if(pos0 && pos1) cnt01++;
        else if(pos0) cnt0++;
        else if(pos1) cnt1++;
        else {cout<<0;return 0;}
    }
    cout<<comb(cnt01,sum[0]-cnt1);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 460 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 460 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 41 ms 10324 KB Output is correct
36 Correct 60 ms 10860 KB Output is correct
37 Correct 44 ms 11088 KB Output is correct
38 Correct 45 ms 11192 KB Output is correct
39 Correct 42 ms 10068 KB Output is correct
40 Correct 45 ms 11124 KB Output is correct
41 Correct 44 ms 11092 KB Output is correct
42 Correct 40 ms 10064 KB Output is correct
43 Correct 40 ms 10068 KB Output is correct
44 Correct 38 ms 10176 KB Output is correct
45 Correct 38 ms 10064 KB Output is correct
46 Correct 37 ms 9964 KB Output is correct
47 Correct 38 ms 9972 KB Output is correct
48 Correct 45 ms 11092 KB Output is correct
49 Correct 45 ms 11092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 460 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 41 ms 10324 KB Output is correct
36 Correct 60 ms 10860 KB Output is correct
37 Correct 44 ms 11088 KB Output is correct
38 Correct 45 ms 11192 KB Output is correct
39 Correct 42 ms 10068 KB Output is correct
40 Correct 45 ms 11124 KB Output is correct
41 Correct 44 ms 11092 KB Output is correct
42 Correct 40 ms 10064 KB Output is correct
43 Correct 40 ms 10068 KB Output is correct
44 Correct 38 ms 10176 KB Output is correct
45 Correct 38 ms 10064 KB Output is correct
46 Correct 37 ms 9964 KB Output is correct
47 Correct 38 ms 9972 KB Output is correct
48 Correct 45 ms 11092 KB Output is correct
49 Correct 45 ms 11092 KB Output is correct
50 Correct 54 ms 12884 KB Output is correct
51 Correct 54 ms 12884 KB Output is correct
52 Correct 54 ms 12924 KB Output is correct
53 Correct 61 ms 13044 KB Output is correct
54 Correct 54 ms 12928 KB Output is correct
55 Correct 55 ms 12884 KB Output is correct
56 Correct 58 ms 12880 KB Output is correct
57 Correct 49 ms 12032 KB Output is correct
58 Correct 53 ms 13040 KB Output is correct
59 Correct 53 ms 13080 KB Output is correct
60 Correct 50 ms 12268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 464 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 460 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 41 ms 10324 KB Output is correct
36 Correct 60 ms 10860 KB Output is correct
37 Correct 44 ms 11088 KB Output is correct
38 Correct 45 ms 11192 KB Output is correct
39 Correct 42 ms 10068 KB Output is correct
40 Correct 45 ms 11124 KB Output is correct
41 Correct 44 ms 11092 KB Output is correct
42 Correct 40 ms 10064 KB Output is correct
43 Correct 40 ms 10068 KB Output is correct
44 Correct 38 ms 10176 KB Output is correct
45 Correct 38 ms 10064 KB Output is correct
46 Correct 37 ms 9964 KB Output is correct
47 Correct 38 ms 9972 KB Output is correct
48 Correct 45 ms 11092 KB Output is correct
49 Correct 45 ms 11092 KB Output is correct
50 Correct 54 ms 12884 KB Output is correct
51 Correct 54 ms 12884 KB Output is correct
52 Correct 54 ms 12924 KB Output is correct
53 Correct 61 ms 13044 KB Output is correct
54 Correct 54 ms 12928 KB Output is correct
55 Correct 55 ms 12884 KB Output is correct
56 Correct 58 ms 12880 KB Output is correct
57 Correct 49 ms 12032 KB Output is correct
58 Correct 53 ms 13040 KB Output is correct
59 Correct 53 ms 13080 KB Output is correct
60 Correct 50 ms 12268 KB Output is correct
61 Correct 107 ms 348 KB Output is correct
62 Correct 106 ms 344 KB Output is correct
63 Correct 106 ms 440 KB Output is correct
64 Correct 105 ms 348 KB Output is correct
65 Correct 83 ms 8044 KB Output is correct
66 Correct 84 ms 6996 KB Output is correct
67 Correct 70 ms 12020 KB Output is correct
68 Correct 102 ms 3116 KB Output is correct
69 Correct 106 ms 348 KB Output is correct
70 Correct 107 ms 348 KB Output is correct
71 Correct 106 ms 352 KB Output is correct