# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72314 | (#118) | Judge Against Wrong Code (FXCUP3_judge) | C++17 | 1586 ms | 31500 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
bool dp[1<<20][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]){
for(int j=0;j<X;j++) if(i&(1<<j)) dp[i][j] = true;
}
else{
for(int j=0;j<X;j++) if(i&(1<<j)){
for(int k=0;k<X;k++) if(dp[i^(1<<j)][k]) dp[i][k] = true;
}
}
}
for(int i=0;i<(1<<X);i++){
bool ok = true;
for(int j=0;j<X;j++) if(i&(1<<j)) if(!dp[i][j]) ok = false;
attack[i] = ok;
}
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |