답안 #792415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
792415 2023-07-25T04:29:18 Z 이온조(#10087) Binaria (CCO23_day1problem1) C++17
25 / 25
82 ms 8120 KB
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6 + 3;

int F[1000009], A[1000009], X[1000009];

int myp(int x, int y) {
	if(y == 0) return 1;
	int m = myp(x, y >> 1);
	if(y&1) return 1LL*m*m%MOD*x%MOD;
	return 1LL*m*m%MOD;
}

int inv(int x) {
	return myp(x, MOD - 2);
}

int main() {
	int N, K; scanf("%d%d", &N, &K);
	int k = K;
	F[0] = 1;
	for(int i=1; i<=N; i++) F[i] = 1LL * F[i-1] * i % MOD;
	for(int i=0; i<N-K+1; i++) {
		scanf("%d", &A[i]);
		if(i && A[i] != A[i-1]) {
			if(X[(i-1) % K] == 0) {
				X[(i-1) % K] = 1;
				if(A[i-1] > A[i]) --A[0];
				--k;
			}
		}
	}
	printf("%d", 1LL * F[k] * inv(F[k - A[0]]) % MOD * inv(F[A[0]]) % MOD);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:33:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   33 |  printf("%d", 1LL * F[k] * inv(F[k - A[0]]) % MOD * inv(F[A[0]]) % MOD);
      |          ~^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |           |                                                      |
      |           int                                                    long long int
      |          %lld
Main.cpp:19:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  int N, K; scanf("%d%d", &N, &K);
      |            ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf("%d", &A[i]);
      |   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 66 ms 8060 KB Output is correct
36 Correct 68 ms 8012 KB Output is correct
37 Correct 70 ms 8012 KB Output is correct
38 Correct 64 ms 8012 KB Output is correct
39 Correct 62 ms 8032 KB Output is correct
40 Correct 65 ms 8060 KB Output is correct
41 Correct 64 ms 8120 KB Output is correct
42 Correct 62 ms 8088 KB Output is correct
43 Correct 62 ms 8032 KB Output is correct
44 Correct 62 ms 8120 KB Output is correct
45 Correct 61 ms 8072 KB Output is correct
46 Correct 63 ms 8028 KB Output is correct
47 Correct 61 ms 8012 KB Output is correct
48 Correct 65 ms 8020 KB Output is correct
49 Correct 64 ms 8096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 66 ms 8060 KB Output is correct
36 Correct 68 ms 8012 KB Output is correct
37 Correct 70 ms 8012 KB Output is correct
38 Correct 64 ms 8012 KB Output is correct
39 Correct 62 ms 8032 KB Output is correct
40 Correct 65 ms 8060 KB Output is correct
41 Correct 64 ms 8120 KB Output is correct
42 Correct 62 ms 8088 KB Output is correct
43 Correct 62 ms 8032 KB Output is correct
44 Correct 62 ms 8120 KB Output is correct
45 Correct 61 ms 8072 KB Output is correct
46 Correct 63 ms 8028 KB Output is correct
47 Correct 61 ms 8012 KB Output is correct
48 Correct 65 ms 8020 KB Output is correct
49 Correct 64 ms 8096 KB Output is correct
50 Correct 82 ms 8012 KB Output is correct
51 Correct 68 ms 8088 KB Output is correct
52 Correct 70 ms 8120 KB Output is correct
53 Correct 71 ms 8036 KB Output is correct
54 Correct 69 ms 8120 KB Output is correct
55 Correct 70 ms 8016 KB Output is correct
56 Correct 68 ms 8096 KB Output is correct
57 Correct 66 ms 8120 KB Output is correct
58 Correct 68 ms 8012 KB Output is correct
59 Correct 70 ms 8000 KB Output is correct
60 Correct 67 ms 8112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 66 ms 8060 KB Output is correct
36 Correct 68 ms 8012 KB Output is correct
37 Correct 70 ms 8012 KB Output is correct
38 Correct 64 ms 8012 KB Output is correct
39 Correct 62 ms 8032 KB Output is correct
40 Correct 65 ms 8060 KB Output is correct
41 Correct 64 ms 8120 KB Output is correct
42 Correct 62 ms 8088 KB Output is correct
43 Correct 62 ms 8032 KB Output is correct
44 Correct 62 ms 8120 KB Output is correct
45 Correct 61 ms 8072 KB Output is correct
46 Correct 63 ms 8028 KB Output is correct
47 Correct 61 ms 8012 KB Output is correct
48 Correct 65 ms 8020 KB Output is correct
49 Correct 64 ms 8096 KB Output is correct
50 Correct 82 ms 8012 KB Output is correct
51 Correct 68 ms 8088 KB Output is correct
52 Correct 70 ms 8120 KB Output is correct
53 Correct 71 ms 8036 KB Output is correct
54 Correct 69 ms 8120 KB Output is correct
55 Correct 70 ms 8016 KB Output is correct
56 Correct 68 ms 8096 KB Output is correct
57 Correct 66 ms 8120 KB Output is correct
58 Correct 68 ms 8012 KB Output is correct
59 Correct 70 ms 8000 KB Output is correct
60 Correct 67 ms 8112 KB Output is correct
61 Correct 7 ms 4180 KB Output is correct
62 Correct 7 ms 4120 KB Output is correct
63 Correct 6 ms 4180 KB Output is correct
64 Correct 6 ms 4180 KB Output is correct
65 Correct 44 ms 8100 KB Output is correct
66 Correct 32 ms 6904 KB Output is correct
67 Correct 66 ms 8084 KB Output is correct
68 Correct 12 ms 4820 KB Output is correct
69 Correct 6 ms 4168 KB Output is correct
70 Correct 6 ms 4180 KB Output is correct
71 Correct 6 ms 4180 KB Output is correct