結果
| 問題 |
No.1847 Good Sequence
|
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2021-12-07 02:56:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 710 bytes |
| コンパイル時間 | 1,689 ms |
| コンパイル使用メモリ | 193,312 KB |
| 最終ジャッジ日時 | 2025-01-26 06:25:33 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 RE * 31 |
ソースコード
#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);
f(0);
cout<<ans<<"\n";
}
potato167