Submission #792494

# Submission time Handle Problem Language Result Execution time Memory
792494 2023-07-25T05:57:27 Z 이종영(#10088) Binaria (CCO23_day1problem1) C++17
25 / 25
77 ms 12256 KB
#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
//#include <bits/extc++.h>
//using namespace __gnu_pbds;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
using ll=long long;
//uniform_int_distribution<> gen(1,100);
template <int MOD_> struct modnum{
private:
	int v;
public:
	static const int MOD = MOD_;
	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int () const { return v; }
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
	friend bool operator < (const modnum& a, const modnum& b) { return a.v < b.v; }
	friend bool operator <= (const modnum& a, const modnum& b) { return a.v <= b.v; }
	friend bool operator > (const modnum& a, const modnum& b) { return a.v > b.v; }
	friend bool operator >= (const modnum& a, const modnum& b) { return a.v >= b.v; }
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	friend modnum pow(modnum a, ll p) {
		modnum ans = 1;
		for (; p; p /= 2, a *= a) if (p&1) ans *= a;
		return ans;
	}
	modnum operator ~ () const {
		modnum res;
		res.v = pow((modnum)v, MOD - 2).v;
		return res;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= (~o);
	}
	modnum operator-() const { return modnum(-v); }
	modnum& operator++() { return *this += 1; }
	modnum operator++(int){ modnum tmp=*this; ++*this; return tmp; }
	modnum& operator--() { return *this -= 1; }
	modnum operator--(int){ modnum tmp=*this; --*this; return tmp; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
	friend ostream& operator<<(std::ostream& os, const modnum& o)
	{
		os << o.v;
		return os;
	}
	friend istream& operator>>(std::istream& is, modnum& o)
	{
		is >> o.v;
		return is;
	}
};
const ll mod=1000003;
const int N=1e6+5;
using mi=modnum<mod>;
int n,k,s[N],cnt[3];
mi f[N],invf[N];
mi ncr(int n,int r){
	return f[n]*invf[r]*invf[n-r];
}
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin>>n>>k;
	for(int i=0;i<=n-k;i++) cin>>s[i];
	f[0]=1;
	for(int i=1;i<=n;i++) f[i]=f[i-1]*i;
	invf[n]=~f[n];
	for(int i=n-1;i>=0;i--) invf[i]=invf[i+1]*(i+1);
	for(int m=0;m<k;m++){
		int c=2;
		for(int i=m;i+k<n;i+=k) if(s[i]!=s[i+1]){
			if(s[i]<s[i+1]) c=0;
			else c=1;
			break;
		}
		cnt[c]++;
	}
	cout<<ncr(cnt[2],s[0]-cnt[1]);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
13 Correct 6 ms 8092 KB Output is correct
14 Correct 6 ms 8124 KB Output is correct
15 Correct 6 ms 8148 KB Output is correct
16 Correct 6 ms 8148 KB Output is correct
17 Correct 6 ms 8092 KB Output is correct
18 Correct 6 ms 8036 KB Output is correct
19 Correct 6 ms 8132 KB Output is correct
20 Correct 6 ms 8148 KB Output is correct
21 Correct 6 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
13 Correct 6 ms 8092 KB Output is correct
14 Correct 6 ms 8124 KB Output is correct
15 Correct 6 ms 8148 KB Output is correct
16 Correct 6 ms 8148 KB Output is correct
17 Correct 6 ms 8092 KB Output is correct
18 Correct 6 ms 8036 KB Output is correct
19 Correct 6 ms 8132 KB Output is correct
20 Correct 6 ms 8148 KB Output is correct
21 Correct 6 ms 8148 KB Output is correct
22 Correct 6 ms 8148 KB Output is correct
23 Correct 6 ms 8040 KB Output is correct
24 Correct 6 ms 8148 KB Output is correct
25 Correct 6 ms 8156 KB Output is correct
26 Correct 7 ms 8148 KB Output is correct
27 Correct 8 ms 8128 KB Output is correct
28 Correct 6 ms 8148 KB Output is correct
29 Correct 6 ms 8100 KB Output is correct
30 Correct 6 ms 8148 KB Output is correct
31 Correct 6 ms 8088 KB Output is correct
32 Correct 6 ms 8148 KB Output is correct
33 Correct 6 ms 8148 KB Output is correct
34 Correct 6 ms 8084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
13 Correct 6 ms 8092 KB Output is correct
14 Correct 6 ms 8124 KB Output is correct
15 Correct 6 ms 8148 KB Output is correct
16 Correct 6 ms 8148 KB Output is correct
17 Correct 6 ms 8092 KB Output is correct
18 Correct 6 ms 8036 KB Output is correct
19 Correct 6 ms 8132 KB Output is correct
20 Correct 6 ms 8148 KB Output is correct
21 Correct 6 ms 8148 KB Output is correct
22 Correct 6 ms 8148 KB Output is correct
23 Correct 6 ms 8040 KB Output is correct
24 Correct 6 ms 8148 KB Output is correct
25 Correct 6 ms 8156 KB Output is correct
26 Correct 7 ms 8148 KB Output is correct
27 Correct 8 ms 8128 KB Output is correct
28 Correct 6 ms 8148 KB Output is correct
29 Correct 6 ms 8100 KB Output is correct
30 Correct 6 ms 8148 KB Output is correct
31 Correct 6 ms 8088 KB Output is correct
32 Correct 6 ms 8148 KB Output is correct
33 Correct 6 ms 8148 KB Output is correct
34 Correct 6 ms 8084 KB Output is correct
35 Correct 58 ms 12044 KB Output is correct
36 Correct 59 ms 11964 KB Output is correct
37 Correct 63 ms 11924 KB Output is correct
38 Correct 71 ms 12024 KB Output is correct
39 Correct 66 ms 11940 KB Output is correct
40 Correct 60 ms 11980 KB Output is correct
41 Correct 59 ms 12048 KB Output is correct
42 Correct 55 ms 12048 KB Output is correct
43 Correct 54 ms 12048 KB Output is correct
44 Correct 57 ms 11936 KB Output is correct
45 Correct 54 ms 11968 KB Output is correct
46 Correct 57 ms 11956 KB Output is correct
47 Correct 53 ms 12048 KB Output is correct
48 Correct 60 ms 12044 KB Output is correct
49 Correct 60 ms 12004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
13 Correct 6 ms 8092 KB Output is correct
14 Correct 6 ms 8124 KB Output is correct
15 Correct 6 ms 8148 KB Output is correct
16 Correct 6 ms 8148 KB Output is correct
17 Correct 6 ms 8092 KB Output is correct
18 Correct 6 ms 8036 KB Output is correct
19 Correct 6 ms 8132 KB Output is correct
20 Correct 6 ms 8148 KB Output is correct
21 Correct 6 ms 8148 KB Output is correct
22 Correct 6 ms 8148 KB Output is correct
23 Correct 6 ms 8040 KB Output is correct
24 Correct 6 ms 8148 KB Output is correct
25 Correct 6 ms 8156 KB Output is correct
26 Correct 7 ms 8148 KB Output is correct
27 Correct 8 ms 8128 KB Output is correct
28 Correct 6 ms 8148 KB Output is correct
29 Correct 6 ms 8100 KB Output is correct
30 Correct 6 ms 8148 KB Output is correct
31 Correct 6 ms 8088 KB Output is correct
32 Correct 6 ms 8148 KB Output is correct
33 Correct 6 ms 8148 KB Output is correct
34 Correct 6 ms 8084 KB Output is correct
35 Correct 58 ms 12044 KB Output is correct
36 Correct 59 ms 11964 KB Output is correct
37 Correct 63 ms 11924 KB Output is correct
38 Correct 71 ms 12024 KB Output is correct
39 Correct 66 ms 11940 KB Output is correct
40 Correct 60 ms 11980 KB Output is correct
41 Correct 59 ms 12048 KB Output is correct
42 Correct 55 ms 12048 KB Output is correct
43 Correct 54 ms 12048 KB Output is correct
44 Correct 57 ms 11936 KB Output is correct
45 Correct 54 ms 11968 KB Output is correct
46 Correct 57 ms 11956 KB Output is correct
47 Correct 53 ms 12048 KB Output is correct
48 Correct 60 ms 12044 KB Output is correct
49 Correct 60 ms 12004 KB Output is correct
50 Correct 72 ms 12040 KB Output is correct
51 Correct 70 ms 11940 KB Output is correct
52 Correct 74 ms 12256 KB Output is correct
53 Correct 67 ms 11964 KB Output is correct
54 Correct 68 ms 11992 KB Output is correct
55 Correct 67 ms 12036 KB Output is correct
56 Correct 68 ms 12012 KB Output is correct
57 Correct 67 ms 12028 KB Output is correct
58 Correct 68 ms 12112 KB Output is correct
59 Correct 77 ms 12040 KB Output is correct
60 Correct 62 ms 11956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8020 KB Output is correct
2 Correct 6 ms 8148 KB Output is correct
3 Correct 6 ms 8148 KB Output is correct
4 Correct 6 ms 8092 KB Output is correct
5 Correct 7 ms 8148 KB Output is correct
6 Correct 6 ms 8128 KB Output is correct
7 Correct 7 ms 8212 KB Output is correct
8 Correct 6 ms 8148 KB Output is correct
9 Correct 6 ms 8148 KB Output is correct
10 Correct 6 ms 8148 KB Output is correct
11 Correct 6 ms 8148 KB Output is correct
12 Correct 6 ms 8128 KB Output is correct
13 Correct 6 ms 8092 KB Output is correct
14 Correct 6 ms 8124 KB Output is correct
15 Correct 6 ms 8148 KB Output is correct
16 Correct 6 ms 8148 KB Output is correct
17 Correct 6 ms 8092 KB Output is correct
18 Correct 6 ms 8036 KB Output is correct
19 Correct 6 ms 8132 KB Output is correct
20 Correct 6 ms 8148 KB Output is correct
21 Correct 6 ms 8148 KB Output is correct
22 Correct 6 ms 8148 KB Output is correct
23 Correct 6 ms 8040 KB Output is correct
24 Correct 6 ms 8148 KB Output is correct
25 Correct 6 ms 8156 KB Output is correct
26 Correct 7 ms 8148 KB Output is correct
27 Correct 8 ms 8128 KB Output is correct
28 Correct 6 ms 8148 KB Output is correct
29 Correct 6 ms 8100 KB Output is correct
30 Correct 6 ms 8148 KB Output is correct
31 Correct 6 ms 8088 KB Output is correct
32 Correct 6 ms 8148 KB Output is correct
33 Correct 6 ms 8148 KB Output is correct
34 Correct 6 ms 8084 KB Output is correct
35 Correct 58 ms 12044 KB Output is correct
36 Correct 59 ms 11964 KB Output is correct
37 Correct 63 ms 11924 KB Output is correct
38 Correct 71 ms 12024 KB Output is correct
39 Correct 66 ms 11940 KB Output is correct
40 Correct 60 ms 11980 KB Output is correct
41 Correct 59 ms 12048 KB Output is correct
42 Correct 55 ms 12048 KB Output is correct
43 Correct 54 ms 12048 KB Output is correct
44 Correct 57 ms 11936 KB Output is correct
45 Correct 54 ms 11968 KB Output is correct
46 Correct 57 ms 11956 KB Output is correct
47 Correct 53 ms 12048 KB Output is correct
48 Correct 60 ms 12044 KB Output is correct
49 Correct 60 ms 12004 KB Output is correct
50 Correct 72 ms 12040 KB Output is correct
51 Correct 70 ms 11940 KB Output is correct
52 Correct 74 ms 12256 KB Output is correct
53 Correct 67 ms 11964 KB Output is correct
54 Correct 68 ms 11992 KB Output is correct
55 Correct 67 ms 12036 KB Output is correct
56 Correct 68 ms 12012 KB Output is correct
57 Correct 67 ms 12028 KB Output is correct
58 Correct 68 ms 12112 KB Output is correct
59 Correct 77 ms 12040 KB Output is correct
60 Correct 62 ms 11956 KB Output is correct
61 Correct 17 ms 8148 KB Output is correct
62 Correct 19 ms 8136 KB Output is correct
63 Correct 17 ms 8140 KB Output is correct
64 Correct 18 ms 8152 KB Output is correct
65 Correct 48 ms 10060 KB Output is correct
66 Correct 39 ms 9448 KB Output is correct
67 Correct 67 ms 11224 KB Output is correct
68 Correct 22 ms 8404 KB Output is correct
69 Correct 18 ms 8148 KB Output is correct
70 Correct 18 ms 8156 KB Output is correct
71 Correct 18 ms 8152 KB Output is correct