Submission #72892

# Submission time Handle Problem Language Result Execution time Memory
72892 2018-08-27T07:44:22 Z ainta Judge Against Wrong Code (FXCUP3_judge) C++17
100 / 100
582 ms 101580 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int K, n, m, A[1<<20], B[1<<20], C[21][1<<20], CA[1<<20], CB[1<<20], vis[1<<20];
char p[22], q[10] = "xo";
void Calc(int *a) {
	int i, j;
	for (i = 0; i < (1 << K); i++)C[0][i] = a[i];
	for (i = 0; i < K; i++) {
		for (j = 0; j < (1 << K); j++) {
			if ((j >> i) & 1) {
				C[i + 1][j] = C[i][j] + C[i][j ^ (1 << i)];
			}
			else C[i + 1][j] = C[i][j];
		}
	}
}
int main() {
	int i, j;
	scanf("%d%d", &K, &n);
	for (i = 0; i < n; i++) {
		scanf("%s", p);
		int s = 0;
		for (j = 0; j < K; j++) {
			if (p[j] == 'o')s += (1 << j);
		}
		A[s]++;
	}
	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		scanf("%s", p);
		int s = 0;
		for (j = 0; j < K; j++) {
			if (p[j] == 'x')s += (1 << j);
		}
		B[s]++;
	}
	Calc(A);
	for (i = 0; i < (1 << K); i++)CA[i] = C[K][i];
	Calc(B);
	for (i = 0; i < (1 << K); i++)CB[i] = C[K][i];
	for (i = 1; i < (1 << K); i++) {
		for (j = 0; j < K; j++) {
			if (((i >> j) & 1) && CA[i] == CA[i ^ (1 << j)])break;
		}
		if (j == K) {
			vis[m - CB[(1 << K) - 1 - i]] = 1;
		}
	}
	for (i = 1; i <= m; i++)printf("%c", q[vis[i]]);
	puts("");
	return 0;
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &K, &n);
  ~~~~~^~~~~~~~~~~~~~~~
judge.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", p);
   ~~~~~^~~~~~~~~
judge.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
  ~~~~~^~~~~~~~~~
judge.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", p);
   ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 648 KB Output is correct
4 Correct 5 ms 2980 KB Output is correct
5 Correct 5 ms 3056 KB Output is correct
6 Correct 5 ms 3056 KB Output is correct
7 Correct 5 ms 3056 KB Output is correct
8 Correct 5 ms 3056 KB Output is correct
9 Correct 5 ms 3068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 648 KB Output is correct
4 Correct 5 ms 2980 KB Output is correct
5 Correct 5 ms 3056 KB Output is correct
6 Correct 5 ms 3056 KB Output is correct
7 Correct 5 ms 3056 KB Output is correct
8 Correct 5 ms 3056 KB Output is correct
9 Correct 5 ms 3068 KB Output is correct
10 Correct 98 ms 3068 KB Output is correct
11 Correct 67 ms 3068 KB Output is correct
12 Correct 13 ms 3068 KB Output is correct
13 Correct 6 ms 3212 KB Output is correct
14 Correct 113 ms 3304 KB Output is correct
15 Correct 155 ms 3852 KB Output is correct
16 Correct 248 ms 3852 KB Output is correct
17 Correct 310 ms 3872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 648 KB Output is correct
4 Correct 5 ms 2980 KB Output is correct
5 Correct 5 ms 3056 KB Output is correct
6 Correct 5 ms 3056 KB Output is correct
7 Correct 5 ms 3056 KB Output is correct
8 Correct 5 ms 3056 KB Output is correct
9 Correct 5 ms 3068 KB Output is correct
10 Correct 98 ms 3068 KB Output is correct
11 Correct 67 ms 3068 KB Output is correct
12 Correct 13 ms 3068 KB Output is correct
13 Correct 6 ms 3212 KB Output is correct
14 Correct 113 ms 3304 KB Output is correct
15 Correct 155 ms 3852 KB Output is correct
16 Correct 248 ms 3852 KB Output is correct
17 Correct 310 ms 3872 KB Output is correct
18 Correct 231 ms 23972 KB Output is correct
19 Correct 156 ms 46572 KB Output is correct
20 Correct 412 ms 100540 KB Output is correct
21 Correct 289 ms 100540 KB Output is correct
22 Correct 516 ms 101580 KB Output is correct
23 Correct 582 ms 101580 KB Output is correct