Submission #41194

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
411942018-02-13 17:35:18wzyBeautiful row (IZhO12_beauty)C++14
100 / 100
2662 ms165108 KiB
#include <bits/stdc++.h>
using namespace std;
int adj[30] , v[30] , n , m ;
long long dp[20][1<<20] , maxi;
pair<int,int> f(int x){
int z1 , z2 , a1 = 0 , a2 = 0;
z1 = x, z2 = x;
while(z1 > 0){
if(z1%2 == 1) a1++;
z1/=2;
}
while(z2 > 0){
if(z2%3 == 1)a2++;
z2/=3;
}
return pair<int,int>(a1 , a2);
}
long long solve(int i , int j){
if(dp[i][j] != -1) return dp[i][j];
if(j == maxi) return 1;
dp[i][j] = 0;
for(int w = 0 ; w < n; w++){
if(1<<w & j) continue;
if(1<<w & adj[i]) dp[i][j] += solve(w , j | 1<<w);
}
return dp[i][j];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...