Submission #488536

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4885362021-11-19 13:50:20FatihSolakPaths (BOI18_paths)C++17
100 / 100
381 ms93028 KiB
#include <bits/stdc++.h>
#define N 300005
#define K 5
using namespace std;
int n,m,k;
int arr[N];
long long dp[N][(1<<K)];
vector<int > adj[N];
long long f(int v,int mask){
if( (mask & (1<<arr[v])) == 0)return 0;
if(mask == (1<<arr[v]))return 1;
if(dp[v][mask] != -1)return dp[v][mask];
dp[v][mask] = 0;
for(auto u:adj[v]){
dp[v][mask] += f(u,mask^(1<<arr[v]));
}
return dp[v][mask];
}
void solve(){
for(int i=0;i<N;i++){
for(int j=0;j<(1<<K);j++){
dp[i][j] = -1;
}
}
cin >> n >> m >> k;
for(int i=1;i<=n;i++){
cin >> arr[i];
arr[i]--;
}
for(int i=0;i<m;i++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...