Submission #72236

# Submission time Handle Problem Language Result Execution time Memory
72236 2018-08-26T06:15:24 Z BBBSNG(#2263, youngyojun, sebinkim, dlalswp25) Judge Against Wrong Code (FXCUP3_judge) C++17
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int K[1101010], F[1111][1111];
bool ans[505050], cnt[1101010];
int k, b, n, m;

int main()
{
	int i, j, l, s, s1, s2;
	char str[33];
	
	scanf("%d", &k);
	
	b = k / 2;
	
	scanf("%d", &n);
	
	for(i=1; i<=n; i++){
		scanf("%s", str);
		
		for(s=0, j=0; j<k; j++){
			if(str[j] != '.') s |= (1 << j);
		}
		
		K[s] |= s;
	}
	
	scanf("%d", &m);
	
	for(i=1; i<=m; i++){
		scanf("%s", str);
		
		for(s1=0, j=0; j<b; j++){
			if(str[j] != '.') s1 |= (1 << j);
		}
		
		for(s2=0, j=b; j<k; j++){
			if(str[j] != '.') s2 |= (1 << j-b);
		}
		
		F[s1][s2] ++;
	}

	for(i=0; i<(1<<k); i++){
		for(j=0; j<k; j++){
			if(i & (1 << j)) cnt[i] ^= 1;
		}
	}	
	
	for(i=0; i<(1<<b); i++){
		for(j=0; j<(1<<(k-b)); j++){
			for(l=j; l; l=(l-1)&j){
				if(cnt[l]) F[i][j] += F[i][j - l];
				else F[i][j] -= F[i][j - l];
			}
		}
	}
	
	for(i=0; i<(1<<k-b); i++){
		for(j=0; j<(1<<b); j++){
			for(l=j; l; l=(l-1)&j){
				if(cnt[l]) F[j][i] += F[j - l][i];
				else F[j][i] -= F[j - l][i];
			}
		}
	}
	
	for(i=0; i<(1<<k); i++){
		for(j=0; j<k; j++){
			if(i & (1 << j)) K[i] |= K[i - (1 << j)];
		}
		
		if(K[i] == i){
			j = (1 << k) - 1 - i;
//			printf("%d %d %d\n", i, j, F[j & ((1 << b) - 1)][j >> b]);
			ans[m - F[j & ((1 << b) - 1)][j >> b]] = 1;
		}
		
/*		for(l=0; l<k; l++){
			if(i & (1 << l)) printf("1");
			else printf("0");
		}
		printf(" %d %d\n", i, F[i & ((1 << b) - 1)][i >> b]);
*/	}
	
	for(i=1; i<=m; i++){
		printf("%c", ans[i]? 'O' : 'X');
	}
	
	printf("\n");
	
	return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:40:35: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
    if(str[j] != '.') s2 |= (1 << j-b);
                                  ~^~
judge.cpp:61:18: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  for(i=0; i<(1<<k-b); i++){
                 ~^~
judge.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &k);
  ~~~~~^~~~~~~~~~
judge.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
judge.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str);
   ~~~~~^~~~~~~~~~~
judge.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
  ~~~~~^~~~~~~~~~
judge.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str);
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -