답안 #73204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
73204 2018-08-28T04:38:56 Z test 재채점 전쟁 (FXCUP3_judge) C++14
49 / 100
1500 ms 188768 KB
#include<bits/stdc++.h>
using namespace std;

const int MN = 500010;

int X, D, C;
int data[MN], code[MN], cnt1[1 << 20], cnt2[1 << 20];
int dp1[1 << 20][22], dp2[1 << 20][22];
int ans[MN];

int main() {
    scanf("%d", &X);
    scanf("%d", &D);

    for(int i = 0; i < D; i++) {
        scanf("\n");
        for(int j = 0; j < X; j++) {
            char t; scanf("%c", &t);

            if(t == 'o') data[i] ^= (1 << j);
        }
        cnt1[ data[i] ]++;
    }

    scanf("%d", &C);

    for(int i = 0; i < C; i++) {
        scanf("\n");
        for(int j = 0; j < X; j++) {
            char t; scanf("%c", &t);

            if(t == 'x') code[i] ^= (1 << j);
        }
        cnt2[ code[i] ]++;
    }

    for(int i = 0; i < (1 << X); i++) {
        dp1[i][X] = cnt1[i]? i : 0;
        dp2[i][X] = cnt2[i];
    }
    for(int i = X - 1; i >= 0; i--) {
        for(int j = 0; j < (1 << X); j++) {
            if(j & (1 << i)) {
                dp1[j][i] |= dp1[j][i + 1];
                dp1[j][i] |= dp1[j ^ (1 << i)][i + 1];
                dp2[j][i] += dp2[j][i + 1];
                dp2[j][i] += dp2[j ^ (1 << i)][i + 1];
            }
            else {
                dp1[j][i] |= dp1[j][i + 1];
                dp2[j][i] += dp2[j][i + 1];
            }
        }
    }

    for(int i = 0; i < (1 << X); i++) {
        if(dp1[i][0] == i) {
            ans[ C - dp2[(1 << X) - 1 - i][0] ] = 1;
        }
    }
    for(int i = 1; i <= C; i++) {
        if(ans[i]) printf("o");
        else printf("x");
    }
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &X);
     ~~~~~^~~~~~~~~~
judge.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &D);
     ~~~~~^~~~~~~~~~
judge.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
         ~~~~~^~~~~~
judge.cpp:18:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             char t; scanf("%c", &t);
                     ~~~~~^~~~~~~~~~
judge.cpp:25: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("\n");
         ~~~~~^~~~~~
judge.cpp:30:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             char t; scanf("%c", &t);
                     ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 652 KB Output is correct
4 Correct 12 ms 6072 KB Output is correct
5 Correct 14 ms 6200 KB Output is correct
6 Correct 14 ms 6252 KB Output is correct
7 Correct 15 ms 6252 KB Output is correct
8 Correct 17 ms 6252 KB Output is correct
9 Correct 12 ms 6252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 652 KB Output is correct
4 Correct 12 ms 6072 KB Output is correct
5 Correct 14 ms 6200 KB Output is correct
6 Correct 14 ms 6252 KB Output is correct
7 Correct 15 ms 6252 KB Output is correct
8 Correct 17 ms 6252 KB Output is correct
9 Correct 12 ms 6252 KB Output is correct
10 Correct 193 ms 6252 KB Output is correct
11 Correct 218 ms 6252 KB Output is correct
12 Correct 50 ms 6252 KB Output is correct
13 Correct 14 ms 6424 KB Output is correct
14 Correct 495 ms 8488 KB Output is correct
15 Correct 647 ms 9008 KB Output is correct
16 Correct 1016 ms 11020 KB Output is correct
17 Correct 1060 ms 11084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 652 KB Output is correct
4 Correct 12 ms 6072 KB Output is correct
5 Correct 14 ms 6200 KB Output is correct
6 Correct 14 ms 6252 KB Output is correct
7 Correct 15 ms 6252 KB Output is correct
8 Correct 17 ms 6252 KB Output is correct
9 Correct 12 ms 6252 KB Output is correct
10 Correct 193 ms 6252 KB Output is correct
11 Correct 218 ms 6252 KB Output is correct
12 Correct 50 ms 6252 KB Output is correct
13 Correct 14 ms 6424 KB Output is correct
14 Correct 495 ms 8488 KB Output is correct
15 Correct 647 ms 9008 KB Output is correct
16 Correct 1016 ms 11020 KB Output is correct
17 Correct 1060 ms 11084 KB Output is correct
18 Correct 866 ms 49728 KB Output is correct
19 Correct 867 ms 93284 KB Output is correct
20 Execution timed out 1559 ms 188768 KB Time limit exceeded
21 Halted 0 ms 0 KB -