# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72320 | 2018-08-26T07:04:40 Z | (#2175, xdoju, kazel, pps789) | 재채점 전쟁 (FXCUP3_judge) | C++17 | 510 ms | 19092 KB |
#include<cstdio> #include<algorithm> #include<vector> #include<bitset> using namespace std; bitset<20> dp[1<<20]; bool attack[1<<20]; int target[1<<20]; int targetsum[1<<20]; int X,D,C; char buff[22]; char ans[555555]; int main(){ scanf("%d",&X); scanf("%d",&D); for(int i=0;i<D;i++){ scanf("%s",buff); int cur = 0; for(int i=0;i<X;i++) if(buff[i]=='o') cur |= (1<<i); attack[cur] = true; } scanf("%d",&C); for(int i=0;i<C;i++){ scanf("%s",buff); int cur = 0; for(int i=0;i<X;i++) if(buff[i]=='x') cur |= (1<<i); target[cur]++; } for(int i=1;i<(1<<X);i++){ if(attack[i]){ dp[i] = i; } else{ for(int j=0;j<X;j++) if(i&(1<<j)){ dp[i] |= dp[i^(1<<j)]; } } } for(int i=0;i<(1<<X);i++){ attack[i] = (dp[i]==i); } for(int i=1;i<=C;i++) ans[i] = 'x'; for(int i=0;i<(1<<X);i++) targetsum[i] = target[i]; for(int i=0;i<X;i++) for(int j=0;j<(1<<X);j++) if(j&(1<<i)) targetsum[j] += targetsum[j^(1<<i)]; for(int i=0;i<(1<<X);i++) if(attack[i]){ int cur = C; int nonattack = ((1<<X)-1)^i; cur -= targetsum[nonattack]; ans[cur] = 'o'; } printf("%s",ans+1); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 2 ms | 460 KB | Output is correct |
4 | Correct | 7 ms | 960 KB | Output is correct |
5 | Correct | 5 ms | 992 KB | Output is correct |
6 | Correct | 7 ms | 992 KB | Output is correct |
7 | Correct | 6 ms | 992 KB | Output is correct |
8 | Correct | 5 ms | 992 KB | Output is correct |
9 | Correct | 5 ms | 992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 2 ms | 460 KB | Output is correct |
4 | Correct | 7 ms | 960 KB | Output is correct |
5 | Correct | 5 ms | 992 KB | Output is correct |
6 | Correct | 7 ms | 992 KB | Output is correct |
7 | Correct | 6 ms | 992 KB | Output is correct |
8 | Correct | 5 ms | 992 KB | Output is correct |
9 | Correct | 5 ms | 992 KB | Output is correct |
10 | Correct | 57 ms | 1536 KB | Output is correct |
11 | Correct | 64 ms | 1536 KB | Output is correct |
12 | Correct | 11 ms | 1536 KB | Output is correct |
13 | Correct | 6 ms | 1536 KB | Output is correct |
14 | Correct | 90 ms | 1536 KB | Output is correct |
15 | Correct | 119 ms | 2072 KB | Output is correct |
16 | Correct | 212 ms | 2072 KB | Output is correct |
17 | Correct | 222 ms | 2180 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 460 KB | Output is correct |
3 | Correct | 2 ms | 460 KB | Output is correct |
4 | Correct | 7 ms | 960 KB | Output is correct |
5 | Correct | 5 ms | 992 KB | Output is correct |
6 | Correct | 7 ms | 992 KB | Output is correct |
7 | Correct | 6 ms | 992 KB | Output is correct |
8 | Correct | 5 ms | 992 KB | Output is correct |
9 | Correct | 5 ms | 992 KB | Output is correct |
10 | Correct | 57 ms | 1536 KB | Output is correct |
11 | Correct | 64 ms | 1536 KB | Output is correct |
12 | Correct | 11 ms | 1536 KB | Output is correct |
13 | Correct | 6 ms | 1536 KB | Output is correct |
14 | Correct | 90 ms | 1536 KB | Output is correct |
15 | Correct | 119 ms | 2072 KB | Output is correct |
16 | Correct | 212 ms | 2072 KB | Output is correct |
17 | Correct | 222 ms | 2180 KB | Output is correct |
18 | Correct | 174 ms | 5680 KB | Output is correct |
19 | Correct | 140 ms | 7816 KB | Output is correct |
20 | Correct | 305 ms | 18928 KB | Output is correct |
21 | Correct | 263 ms | 18928 KB | Output is correct |
22 | Correct | 510 ms | 19092 KB | Output is correct |
23 | Correct | 460 ms | 19092 KB | Output is correct |