Submission #72314

# Submission time Handle Problem Language Result Execution time Memory
72314 2018-08-26T07:01:26 Z (#2175, xdoju, kazel, pps789) Judge Against Wrong Code (FXCUP3_judge) C++17
49 / 100
1500 ms 31500 KB
#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

judge.cpp: In function 'int main()':
judge.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&X);
     ~~~~~^~~~~~~~~
judge.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&D);
     ~~~~~^~~~~~~~~
judge.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buff);
         ~~~~~^~~~~~~~~~~
judge.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&C);
     ~~~~~^~~~~~~~~
judge.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buff);
         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 288 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 412 KB Output is correct
4 Correct 13 ms 1308 KB Output is correct
5 Correct 16 ms 1308 KB Output is correct
6 Correct 15 ms 1312 KB Output is correct
7 Correct 15 ms 1312 KB Output is correct
8 Correct 15 ms 1440 KB Output is correct
9 Correct 13 ms 1440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 288 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 412 KB Output is correct
4 Correct 13 ms 1308 KB Output is correct
5 Correct 16 ms 1308 KB Output is correct
6 Correct 15 ms 1312 KB Output is correct
7 Correct 15 ms 1312 KB Output is correct
8 Correct 15 ms 1440 KB Output is correct
9 Correct 13 ms 1440 KB Output is correct
10 Correct 69 ms 1516 KB Output is correct
11 Correct 63 ms 1516 KB Output is correct
12 Correct 13 ms 1516 KB Output is correct
13 Correct 18 ms 1548 KB Output is correct
14 Correct 121 ms 1548 KB Output is correct
15 Correct 187 ms 2464 KB Output is correct
16 Correct 244 ms 2464 KB Output is correct
17 Correct 263 ms 2468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 288 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 2 ms 412 KB Output is correct
4 Correct 13 ms 1308 KB Output is correct
5 Correct 16 ms 1308 KB Output is correct
6 Correct 15 ms 1312 KB Output is correct
7 Correct 15 ms 1312 KB Output is correct
8 Correct 15 ms 1440 KB Output is correct
9 Correct 13 ms 1440 KB Output is correct
10 Correct 69 ms 1516 KB Output is correct
11 Correct 63 ms 1516 KB Output is correct
12 Correct 13 ms 1516 KB Output is correct
13 Correct 18 ms 1548 KB Output is correct
14 Correct 121 ms 1548 KB Output is correct
15 Correct 187 ms 2464 KB Output is correct
16 Correct 244 ms 2464 KB Output is correct
17 Correct 263 ms 2468 KB Output is correct
18 Correct 385 ms 8596 KB Output is correct
19 Correct 307 ms 11356 KB Output is correct
20 Correct 1230 ms 31500 KB Output is correct
21 Correct 983 ms 31500 KB Output is correct
22 Correct 1095 ms 31500 KB Output is correct
23 Execution timed out 1586 ms 31500 KB Time limit exceeded