답안 #72284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72284 2018-08-26T06:48:59 Z 김동현보다 잘함(#2226, tlwpdus) 재채점 전쟁 (FXCUP3_judge) C++17
100 / 100
437 ms 9516 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int n, c, d;
int cnt[1100000], dnt[1100000], rd[1100000], ans[500100];

void calc(int cnt[]) {
    int i, j;
    for (i=0;i<n;i++){
        for (j=0;j<(1<<n);j++) {
            if (j>>i&1) cnt[j] += cnt[j^(1<<i)];
        }
    }
    for (i=(1<<n)-1;i>=0;i--) {
        for (j=0;j<n;j++) {
            if (i>>j&1) {
                if (cnt[i]==cnt[i^(1<<j)]) {
                    cnt[i] = 0;
                    break;
                }
            }
        }
    }
}

void rcalc(int cnt[]) {
    int i, j;
    for (i=0;i<n;i++){
        for (j=0;j<(1<<n);j++) {
            if ((j>>i&1)==0) cnt[j] += cnt[j^(1<<i)];
        }
    }
}


char buf[21];
int main() {
    int i;

    scanf("%d",&n);
    scanf("%d",&c);
    for (i=0;i<c;i++){
        scanf("%s",buf);
        int v = 0;
        for (int j=0;j<n;j++) {
            v *= 2;
            v += (buf[j]=='o');
        }
        cnt[v]++;
    }
    scanf("%d",&d);
    for (i=0;i<d;i++){
        scanf("%s",buf);
        int v = 0;
        for (int j=0;j<n;j++) {
            v *= 2;
            v += (buf[j]=='.');
        }
        dnt[v]++;
    }
    calc(cnt);
    rcalc(dnt);
    for (i=0;i<(1<<n);i++) {
        if (!cnt[i])continue;
        ans[d-dnt[i]]=1;
    }
    for (i=1;i<=d;i++) printf(ans[i]?"o":"x");
    printf("\n");

    return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
judge.cpp:46:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&c);
     ~~~~~^~~~~~~~~
judge.cpp:48:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buf);
         ~~~~~^~~~~~~~~~
judge.cpp:56:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&d);
     ~~~~~^~~~~~~~~
judge.cpp:58:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s",buf);
         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 816 KB Output is correct
6 Correct 5 ms 816 KB Output is correct
7 Correct 6 ms 816 KB Output is correct
8 Correct 5 ms 852 KB Output is correct
9 Correct 5 ms 960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 816 KB Output is correct
6 Correct 5 ms 816 KB Output is correct
7 Correct 6 ms 816 KB Output is correct
8 Correct 5 ms 852 KB Output is correct
9 Correct 5 ms 960 KB Output is correct
10 Correct 81 ms 1140 KB Output is correct
11 Correct 64 ms 1140 KB Output is correct
12 Correct 11 ms 1140 KB Output is correct
13 Correct 6 ms 1140 KB Output is correct
14 Correct 80 ms 1140 KB Output is correct
15 Correct 99 ms 1404 KB Output is correct
16 Correct 191 ms 1412 KB Output is correct
17 Correct 180 ms 1436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 396 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 816 KB Output is correct
6 Correct 5 ms 816 KB Output is correct
7 Correct 6 ms 816 KB Output is correct
8 Correct 5 ms 852 KB Output is correct
9 Correct 5 ms 960 KB Output is correct
10 Correct 81 ms 1140 KB Output is correct
11 Correct 64 ms 1140 KB Output is correct
12 Correct 11 ms 1140 KB Output is correct
13 Correct 6 ms 1140 KB Output is correct
14 Correct 80 ms 1140 KB Output is correct
15 Correct 99 ms 1404 KB Output is correct
16 Correct 191 ms 1412 KB Output is correct
17 Correct 180 ms 1436 KB Output is correct
18 Correct 173 ms 2988 KB Output is correct
19 Correct 124 ms 4776 KB Output is correct
20 Correct 328 ms 9392 KB Output is correct
21 Correct 191 ms 9392 KB Output is correct
22 Correct 375 ms 9392 KB Output is correct
23 Correct 437 ms 9516 KB Output is correct