답안 #71998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71998 2018-08-26T04:34:09 Z 마릴린 희정(#2180, gs14004, ho94949) 재채점 전쟁 (FXCUP3_judge) C++17
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int MAXN = 1050000;

int m, n1, n2, a[MAXN], b[MAXN];
char buf[22];

int getMask(){
	scanf("%s",buf);
	int ans = 0;
	for(int i=0; buf[i]; i++){
		if(buf[i] != '.') ans |= (1<<i);
	}
	return ans;
}

int dp[MAXN];
int func[MAXN], cnt[MAXN], ok[MAXN], ret[MAXN];
void fucking_koosaga(){
	int allbit = 0;
	for(int i=0; i<n1; i++){
		allbit |= a[i];
	}
    for (int i = 0; i < (1 << m); i += 1) {
        dp[i] = allbit;
    }
    for(int i=0; i<n1; i++){
    	int x = allbit;
    	x ^= a[i];
    	dp[x] = x;
	}
    for (int i = (1<<m) - 1; i >= 0; i -= 1) {
        if (dp[i] == i) {
        	ok[((1<<m) - 1)^ i] = 1;
        }

        for (int j = 0; j < m; j += 1) {
            if ((1 << j) & i) {
                dp[i ^ (1 << j)] &= dp[i];
            }
        }
    }
}


int main(){
	scanf("%d",&m);
	scanf("%d",&n1);
	for(int i=0; i<n1; i++) a[i] = getMask();
	scanf("%d",&n2);
	for(int i=0; i<n2; i++){
		b[i] = getMask();
		cnt[b[i] ^ ((1<<m) - 1)] ++;
	}
	fucking_koosaga();
	// first, count b_i such that, j & b_i neq 0;
	for(int i=0; i<m; i++){
		for(int j=0; j<(1<<m); j++){
			if((j >> i) & 1){
				cnt[j] += cnt[j ^ (1<<i)];
			}
		}
	}
	for(int j=0; j<(1<<m); j++){
		func[j] = n2 - cnt[((1<<m) - 1) ^ j];
		if(ok[j]) ret[func[j]] = 1;
	}
	for(int i=1; i<=n2; i++) putchar(ret[i] ? 'o' : 'x');
	puts("");
}

/*
struct rmq{
	int tree[530000], lim;
	void init(int n){
		memset(tree, 0x3f, sizeof(tree));
		for(lim = 1; lim < n; lim <<= 1);
		for(int i=0; i<lim; i++){
			l[i + lim] = i + 1;
			r[i + lim] = i + 1;
		}
		for(int i=lim-1; i; i--){
			l[i] = l[2*i];
			r[i] = r[2*i+1];
		}
	}
	int query(int s, int e){
		s--, e--;
		s += lim;
		e += lim;
		int ret = 1e9;
		while(s < e){
			if(s%2 == 1) ret = min(ret, tree[s++]);
			if(e%2 == 0) ret = min(ret, tree[e--]);
			s >>= 1;
			e >>= 1;
		}
		if(s == e) ret = min(ret, tree[s]);
		return ret;
	}
}rmq;

int n, q, a[200005];
int main(){
	scanf("%d %d",&n,&q);
	rmq.init(n);
	for(int i=1; i<=n; i++){
		scanf("%*d",&a[i]);
		rmq.add(i, a[i]);
	}
	while(q--){ int l, r; scanf("%d %d",&l,&r);
		printf("%d\n", rmq.query(l, r));
	}
}o*/

Compilation message

judge.cpp: In function 'int getMask()':
judge.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",buf);
  ~~~~~^~~~~~~~~~
judge.cpp: In function 'int main()':
judge.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&m);
  ~~~~~^~~~~~~~~
judge.cpp:51:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n1);
  ~~~~~^~~~~~~~~~
judge.cpp:53:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n2);
  ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -