結果

問題 No.1847 Good Sequence
ユーザー 👑 potato167potato167
提出日時 2021-12-07 02:57:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 751 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 203,312 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 21:34:15
合計ジャッジ時間 7,098 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 80 ms
6,676 KB
testcase_04 AC 38 ms
6,676 KB
testcase_05 AC 50 ms
6,676 KB
testcase_06 AC 31 ms
6,676 KB
testcase_07 AC 82 ms
6,676 KB
testcase_08 AC 22 ms
6,676 KB
testcase_09 AC 14 ms
6,676 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 2 ms
6,676 KB
testcase_39 AC 2 ms
6,676 KB
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
const int INF=2100000000;
const ll mod=1e9+7;
#define rep(i,a) for (ll i=0;i<a;i++)

int L,N,M;
vector<int> K,p;
int ans=0;

void f(int ind){
	if(ind!=L){
		rep(i,N){
			p[ind]=i+1;
			f(ind+1);
		}
	}else{
		rep(j,M){
			int tmp=0;
			rep(i,L){
				if(p[i]==K[j]) tmp++;
				else if(tmp==K[j]) break;
				else tmp=0;
			}
			if(tmp==K[j]){
				ans++;
				break;
			}
		}
	}
	return ;
}

//  rainy ~ 雨に打たれて ~
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin>>L>>N>>M;
	p.resize(L);
	K.resize(M);
	rep(i,M) cin>>K[i];
	assert(L<=1000);
	if(M==0){
		cout<<"0\n";
		return 0;
	}
	f(0);
	cout<<ans<<"\n";
}
0