Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

1A 208K 16ms 代妈

Posted by KatrineYang at 2016-08-29 21:09:32 on Problem 3254 and last updated at 2016-08-30 00:05:23
```这题真的用得着2000ms和65536K？？？
#include <iostream>
#include <stdio.h>
using namespace std;

int states[377] = {0,1,2,4,5,8,9,10,16,17,18,20,21,32,33,34,36,37,40,41,42,64,65,66,68,69,72,73,74,80,81,82,84,85,128,129,130,132,133,136,137,138,144,145,146,148,149,160,161,162,164,165,168,169,170,256,257,258,260,261,264,265,266,272,273,274,276,277,288,289,290,292,293,296,297,298,320,321,322,324,325,328,329,330,336,337,338,340,341,512,513,514,516,517,520,521,522,528,529,530,532,533,544,545,546,548,549,552,553,554,576,577,578,580,581,584,585,586,592,593,594,596,597,640,641,642,644,645,648,649,650,656,657,658,660,661,672,673,674,676,677,680,681,682,1024,1025,1026,1028,1029,1032,1033,1034,1040,1041,1042,1044,1045,1056,1057,1058,1060,1061,1064,1065,1066,1088,1089,1090,1092,1093,1096,1097,1098,1104,1105,1106,1108,1109,1152,1153,1154,1156,1157,1160,1161,1162,1168,1169,1170,1172,1173,1184,1185,1186,1188,1189,1192,1193,1194,1280,1281,1282,1284,1285,1288,1289,1290,1296,1297,1298,1300,1301,1312,1313,1314,1316,1317,1320,1321,1322,1344,1345,1346,1348,1349,1352,1353,1354,1360,1361,1362,1364,1365,2048,2049,2050,2052,2053,2056,2057,2058,2064,2065,2066,2068,2069,2080,2081,2082,2084,2085,2088,2089,2090,2112,2113,2114,2116,2117,2120,2121,2122,2128,2129,2130,2132,2133,2176,2177,2178,2180,2181,2184,2185,2186,2192,2193,2194,2196,2197,2208,2209,2210,2212,2213,2216,2217,2218,2304,2305,2306,2308,2309,2312,2313,2314,2320,2321,2322,2324,2325,2336,2337,2338,2340,2341,2344,2345,2346,2368,2369,2370,2372,2373,2376,2377,2378,2384,2385,2386,2388,2389,2560,2561,2562,2564,2565,2568,2569,2570,2576,2577,2578,2580,2581,2592,2593,2594,2596,2597,2600,2601,2602,2624,2625,2626,2628,2629,2632,2633,2634,2640,2641,2642,2644,2645,2688,2689,2690,2692,2693,2696,2697,2698,2704,2705,2706,2708,2709,2720,2721,2722,2724,2725,2728,2729,2730};

bool has(int n, int bit){
return ((n & (1<<bit)) != 0);
}

const int MOD = 1e8;

int main() {
int N, M;
scanf("%d%d", &M, &N);
int fert[14];
for(int i = 0; i < M; i++){
for(int j = 0; j < N; j++){
int tmp;
scanf("%d", &tmp);
if(tmp){
fert[i] += (1 << j);
}
}
}
long long int zs[14][377];
for(int i = 0; i < 377; i++){
if((states[i] | fert[0]) == fert[0]){
zs[0][i] = 1;
}
else zs[0][i] = 0;
}
for(int i = 1; i < M; i++){
for(int j = 0; j < 377; j++){
if((states[j] | fert[i]) != fert[i]) {
zs[i][j] = 0;
continue;
}
zs[i][j] = 0;
for(int k = 0; k < 377; k++){
if((states[j] & states[k]) == 0){
zs[i][j] += zs[i-1][k];
}
}
zs[i][j] %= MOD;
}
}
long long int res = 0;
for(int i = 0; i < 377; i++){
res += zs[M-1][i];
}
printf("%I64d\n", res%MOD);
return 0;
}
```

Followed by: