답안 #72176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72176 2018-08-26T05:46:31 Z (#2175, xdoju, kazel, pps789) 재채점 전쟁 (FXCUP3_judge) C++17
49 / 100
1500 ms 2460 KB
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

bool attack[1<<20];
int target[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++){
        int cur = 0;
        for(int j=i;j;j=((j-1)&i)) if(attack[j]){
            cur |= j;
            if(cur==i){
                attack[i] = true;
                break;
            }
        }
    }

    for(int i=1;i<=C;i++) ans[i] = 'x';
    for(int i=0;i<(1<<X);i++) if(attack[i]){
        int cur = C-target[0];
        int nonattack = ((1<<X)-1)^i;
        for(int j=nonattack;j;j=((j-1)&nonattack)) cur -= target[j];
        ans[cur] = 'o';
    }

    printf("%s",ans+1);
    return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&X);
     ~~~~~^~~~~~~~~
judge.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&D);
     ~~~~~^~~~~~~~~
judge.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buff);
         ~~~~~^~~~~~~~~~~
judge.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&C);
     ~~~~~^~~~~~~~~
judge.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buff);
         ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 21 ms 544 KB Output is correct
5 Correct 22 ms 544 KB Output is correct
6 Correct 18 ms 544 KB Output is correct
7 Correct 25 ms 676 KB Output is correct
8 Correct 22 ms 676 KB Output is correct
9 Correct 21 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 21 ms 544 KB Output is correct
5 Correct 22 ms 544 KB Output is correct
6 Correct 18 ms 544 KB Output is correct
7 Correct 25 ms 676 KB Output is correct
8 Correct 22 ms 676 KB Output is correct
9 Correct 21 ms 676 KB Output is correct
10 Correct 57 ms 1524 KB Output is correct
11 Correct 70 ms 1524 KB Output is correct
12 Correct 12 ms 1524 KB Output is correct
13 Correct 20 ms 1524 KB Output is correct
14 Correct 123 ms 1524 KB Output is correct
15 Correct 141 ms 1660 KB Output is correct
16 Correct 239 ms 1804 KB Output is correct
17 Correct 298 ms 1804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 488 KB Output is correct
4 Correct 21 ms 544 KB Output is correct
5 Correct 22 ms 544 KB Output is correct
6 Correct 18 ms 544 KB Output is correct
7 Correct 25 ms 676 KB Output is correct
8 Correct 22 ms 676 KB Output is correct
9 Correct 21 ms 676 KB Output is correct
10 Correct 57 ms 1524 KB Output is correct
11 Correct 70 ms 1524 KB Output is correct
12 Correct 12 ms 1524 KB Output is correct
13 Correct 20 ms 1524 KB Output is correct
14 Correct 123 ms 1524 KB Output is correct
15 Correct 141 ms 1660 KB Output is correct
16 Correct 239 ms 1804 KB Output is correct
17 Correct 298 ms 1804 KB Output is correct
18 Correct 607 ms 2460 KB Output is correct
19 Execution timed out 1540 ms 2460 KB Time limit exceeded
20 Halted 0 ms 0 KB -